Platform
Resources
Pricing
Sign in
Get started
Joanna Slusarewicz
Graduate student who spends her free time hijacking math for poetry purposes.
Workspace
Fork
Published
Prototypes
By
Joanna Slusarewicz
Edited
Apr 19, 2021
Fork of
Matrix Poems
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
poem1
=
[
[
"each"
,
"bluebird"
,
"wing"
,
"flapping"
]
,
[
"weather"
,
"sings"
,
"over"
,
"our"
]
,
[
"blue"
,
"icy"
,
"sky"
,
"chasm"
]
,
[
"and"
,
"frost"
,
"colored"
,
"motion"
]
]
;
Insert cell
join1
=
[
[
[
" "
,
" "
]
,
[
" "
,
" "
]
,
[
" "
,
" "
]
,
[
" "
,
" "
]
]
,
[
[
" a "
,
" "
]
,
[
" with "
,
" "
]
,
[
" "
,
" "
]
,
[
" "
,
" "
]
]
,
[
[
" "
,
" "
]
,
[
", "
,
" "
]
,
[
"-"
,
"-"
]
,
[
"-"
,
" "
]
]
,
[
[
" "
,
" "
]
,
[
" "
,
"-"
]
,
[
" "
,
" "
]
,
[
" "
,
" "
]
]
]
;
Insert cell
Insert cell
Insert cell
function
toPoem
(
text
,
poempair
)
{
let
poem
=
poempair
[
0
]
;
let
punc
=
poempair
[
1
]
;
let
output
=
""
;
if
(
text
.
length
<
1
)
{
output
=
toPoem
(
"something"
,
poempair
)
;
return
output
;
}
output
=
poem
[
0
]
[
0
]
;
let
binary
=
toBinary
(
text
)
;
let
row
=
0
;
let
col
=
0
;
let
rowMax
=
poem
.
length
;
let
colMax
=
poem
[
0
]
.
length
;
for
(
var
i
=
0
;
i
<
binary
.
length
;
i
++
)
{
output
+=
punc
[
row
]
[
col
]
[
parseInt
(
binary
[
i
]
)
]
;
if
(
binary
[
i
]
===
"0"
)
{
row
++
;
}
else
{
col
++
;
}
if
(
row
>
rowMax
-
1
||
col
>
colMax
-
1
)
{
output
+=
"<br>"
}
row
=
row
%
rowMax
;
col
=
col
%
colMax
;
output
+=
poem
[
row
]
[
col
]
;
}
return
output
;
}
Insert cell
function
toTitle
(
userInput
)
{
if
(
userInput
===
""
)
{
return
"something"
;
}
return
userInput
;
}
Insert cell
function
toBinary
(
text
)
{
let
output
=
""
;
let
lowText
=
text
.
toLowerCase
(
)
;
for
(
var
i
=
0
;
i
<
lowText
.
length
;
i
++
)
{
output
+=
text
[
i
]
.
charCodeAt
(
0
)
.
toString
(
2
)
.
substring
(
3
,
8
)
;
// if (letterMap5.has(lowText[i])) {
// output += letterMap5.get(text.toLowerCase()[i]);
// }
}
return
output
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
textInput
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
selectedPoem
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
poem1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
join1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
poemList
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
toPoem
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
toTitle
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
toBinary
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
letterMap4
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
letterMap5
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
RiTa
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML