Platform
Resources
Pricing
Sign in
Get started
Matt Diamond
Creator of /r/AskOuija, a collective intelligence masquerading as a subreddit.
Workspace
Fork
Public
By
Matt Diamond
Edited
Apr 30, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
cycle
=
list
=>
{
const
go
=
(
[
x
,
...
xs
]
)
=>
x
?
new
Stream
(
x
,
(
)
=>
go
(
xs
)
)
:
go
(
list
)
;
return
go
(
list
)
;
}
;
Insert cell
Insert cell
nat
=
{
const
_nat
=
new
Stream
(
0
,
(
)
=>
_nat
.
map
(
R
.
add
(
1
)
)
)
;
return
_nat
;
}
Insert cell
Insert cell
primes
=
{
const
go
=
n
=>
new
Stream
(
n
,
(
)
=>
go
(
n
+
1
)
.
filter
(
x
=>
x
%
n
!==
0
)
)
;
return
go
(
2
)
;
}
Insert cell
Insert cell
fib
=
{
const
add
=
R
.
lift
(
R
.
add
)
;
// fib = [0, ...(fib + [1, ...fib])]
const
_fib
=
new
Stream
(
0
,
(
)
=>
add
(
_fib
,
new
Stream
(
1
,
(
)
=>
_fib
)
)
)
;
return
_fib
;
}
Insert cell
(
ratio
(
fib
)
)
.
at
(
20
)
Insert cell
R
.
take
(
20
)
(
R
.
lift
(
R
.
multiply
)
(
nat
)
(
primes
)
)
Insert cell
{
const
zip
=
R
.
lift
(
R
.
pair
)
;
const
zipped
=
R
.
take
(
5
)
(
zip
(
nat
)
(
primes
)
)
;
return
zipped
.
map
(
R
.
toString
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Array
.
from
(
take
(
primes
,
10
)
)
;
Insert cell
interleave
(
nat
,
Stream
.
of
(
'f'
)
)
.
take
(
20
)
Insert cell
{
let
last
=
null
;
for
(
const
p
of
primes
)
{
if
(
last
&&
p
-
last
===
20
)
{
return
[
last
,
p
]
;
}
last
=
p
;
}
}
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
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Stream
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Lazy
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
cycle
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
nat
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
primes
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
fib
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interleave
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
iterate
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
diff
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ratio
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
take
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
R
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML