30. WHY
Persistent data structures
[0 1 2 3 4 5 6]
[0 1 2 3 4 5 6 7 8 9]
The pink coloured nodes are shared
between the vectors, whereas the
brown and blue are separate.
31. WHY
The pink coloured nodes
are shared between the
vectors, whereas the brown
and blue are separate.
Persistent data structures
33. WHY
Lazy sequences
Function that produces values wrapped
into a sequence interface
(take 10 (fibonacci-producer))
Infinite collection (or very big one)
34. WHY
Lazy sequences
var hugeCollection = [1, 2, 3, … 10^9];
function getTransformer(collection) {
return _(collection).map(function(v) { return v * 2; }
}
var transformed = getTransformer(hugeCollection);
transformed.take(10).value();
35. WHY
Lazy sequences
var hugeCollection = [1, 2, 3, … 10^9];
function getTransformer(collection) {
return _(collection).map(function(v) { return v * 2; }
}
var transformed = getTransformer(hugeCollection);
transformed.take(10).value(); //1,000,000,000