Skip to content

zot/Generators.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generators

Very lightweight, task-based generators.

Generators.jl Documentation

# Generators.generateMethod.

generate(func::Function)

Create a generator from func. Func receives a "yield" function as its argument. You can use this function to produce values.

Here's an example of a recursive generator:

flattened(list) = generate() do yield
    fl(el::Vector) = foreach(fl, el)
    fl(el) = yield(el)
    fl(list)
end

[flattened([1, [2, [3], 4], 5])...] == [1,2,3,4,5]

About

Lightweight, task-based generators for Julia

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages