Tutorial by Examples

In Julia, when looping through an iterable object I is done with the for syntax: for i = I # or "for i in I" # body end Behind the scenes, this is translated to: state = start(I) while !done(I, state) (i, state) = next(I, state) # body end Therefore, if you wan...
The standard library comes with a rich collection of lazy iterables (and libraries such as Iterators.jl provide even more). Lazy iterables can be composed to create more powerful iterables in constant time. The most important lazy iterables are take and drop, from which many other functions can be c...
It's possible to make a simple lazily-evaluated list using mutable types and closures. A lazily-evaluated list is a list whose elements are not evaluated when it's constructed, but rather when it is accessed. Benefits of lazily evaluated lists include the possibility of being infinite. import Base:...

Page 1 of 1