Operating on infinite lists
Home
Today we’re going to step through one of my favorite exercises in composing functions - building and operating on infinite streams of data.
The question we’ll be answering is: How might you represent the following operations?
nums
// => 1, 2, 3, 4, ...
double(nums)
// => 2, 4, 6, 8, ...
fib
// => 0, 1, 1, 2, 3, 5, 8, ...
This post contains code written in JavaScript, but the ideas here apply to any language with functions and lists.
🔗
The Finite
We can build a finite list in JavaScript ...
Read more at notes.jordanscales.com