Skip to content

Lightweight, task-based generators for Julia

License

Notifications You must be signed in to change notification settings

yuggoth-fungus/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

No packages published

Languages

  • Julia 54.2%
  • JavaScript 28.2%
  • CSS 17.6%