Platform
Resources
Pricing
Sign in
Get started
Jesse Varnado
Workspace
Fork
Published
By
Jesse Varnado
Edited
Jan 11, 2022
Importers
3 stars
Insert cell
Insert cell
observeHighland
(
randomIconsStream
)
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
)
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
.
through
(
lastN
(
10
)
)
.
invoke
(
'join'
,
[
''
]
)
)
Insert cell
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
.
through
(
lastN
(
n
)
)
.
invoke
(
'join'
,
[
''
]
)
)
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
.
uniq
(
)
.
through
(
lastN
(
n
)
)
.
invoke
(
'join'
,
[
''
]
)
)
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
.
through
(
lastN
(
n
)
)
.
invoke
(
'join'
,
[
''
]
)
.
zip
(
randomIconsStream
.
observe
(
)
.
uniq
(
)
.
through
(
lastN
(
n
)
)
.
invoke
(
'join'
,
[
''
]
)
)
.
map
(
(
[
first
,
last
]
)
=>
`\n${
first
}\n${
last
}\n`
)
)
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
.
zip
(
timer
.
fork
(
)
.
latest
(
)
)
.
map
(
(
[
icon
,
elapsedTime
]
)
=>
(
{
icon
,
elapsedTime
}
)
)
)
Insert cell
observeHighland
(
randomIconsStream
.
observe
(
)
.
uniq
(
)
.
zip
(
timer
.
fork
(
)
.
latest
(
)
)
.
map
(
(
[
icon
,
elapsedTime
]
)
=>
(
{
icon
,
elapsedTime
}
)
)
)
Insert cell
Insert cell
observeHighland
(
timer
.
observe
(
)
.
throttle
(
100
)
)
Insert cell
observeHighland
(
highland
(
[
{
id
:
1
}
,
{
status
:
2
}
,
{
id
:
2
}
,
10
,
null
,
{
id
:
3
}
,
[
]
,
{
id
:
4
}
,
{
id
:
6
}
]
)
.
flatMap
(
delay
(
1000
)
)
.
pluck
(
'id'
)
.
collect
(
)
)
Insert cell
Insert cell
Insert cell
randomIconsStream
=
highland
(
randomIcons
(
)
)
.
flatMap
(
delay
(
delayTime
)
)
// .take(50)
Insert cell
observeHighland
(
highland
(
randomNumber
(
0
,
100
)
)
.
through
(
average
)
.
through
(
takeEveryNth
(
10000
)
)
.
take
(
10
)
.
collect
(
)
)
Insert cell
observeHighland
(
integerStream
.
flatMap
(
delay
(
100
)
)
)
Insert cell
observeHighland
(
integerStream
.
observe
(
)
.
through
(
sample
)
)
Insert cell
observeHighland
(
integerStream
.
observe
(
)
.
through
(
takeEveryNth
(
10
)
)
)
Insert cell
takeEveryNth
=
nth
=>
stream
=>
stream
.
scan
(
{
}
,
(
{
count
=
0
,
last
}
,
next
)
=>
(
(
count
+
1
)
%
nth
)
===
0
?
{
count
:
count
+
1
,
last
:
next
}
:
{
count
:
count
+
1
,
last
}
)
.
map
(
highland
.
get
(
'last'
)
)
.
uniq
(
)
.
drop
(
1
)
//the first value emitted is the default case
Insert cell
sample
=
stream
=>
stream
.
scan
(
[
]
,
(
last
,
next
)
=>
_
.
random
(
0
,
1
)
===
1
?
next
:
last
)
.
uniq
(
)
.
drop
(
1
)
//the first value emitted is the default case
Insert cell
average
=
(
stream
)
=>
stream
.
scan
(
{
count
:
0
,
sum
:
0
,
average
:
0
}
,
(
{
count
,
sum
,
average
}
,
number
)
=>
(
{
number
,
count
:
count
+
1
,
sum
:
sum
+
number
,
average
:
(
average
*
count
+
number
)
/
(
count
+
1
)
}
)
)
.
drop
(
1
)
//the first value emitted is the default case
Insert cell
randomNumberStream
=
(
min
,
max
)
=>
highland
(
randomNumber
(
min
,
max
)
)
.
flatMap
(
delay
(
delayTime
)
)
Insert cell
observeHighland
=
stream
=>
Generators
.
queue
(
(
change
)
=>
{
stream
.
errors
(
error
=>
change
(
`error: ${
error
}`
)
)
.
each
(
change
)
return
(
)
=>
change
(
'invalidated!'
)
&&
stream
.
destroy
(
)
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_
=
require
(
'lodash'
)
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
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
n
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
lastN
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
timer
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
delayTime
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
randomIconsStream
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
takeEveryNth
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
average
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
randomNumberStream
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
observeHighland
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
timerStream
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
randomNumber
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
integerStream
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
integers
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
randomIcons
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
randomIcon
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
delay
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
_
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
highland
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML