Corner.Generater (corner v0.1.2)
This module define macro defgen/2
.
defgen
use to define generater in elixir.
In the context of the defgen
you can use keyword
yield
to return a value and stop execute, like it is in Javascript or lua.
example
Example
iex> import Corner.Generater
iex> defgen my_generater do
...> a, b ->
...> yield a
...> yield b
...> yield a + b
...> end
iex> g = my_generater.(1,2)
iex> for t <- g do
...> t
...> end
[1,2,3]
Link to this section Summary
Functions
Check if the generater
is done.
Get next value form the generater g
.
Check if the generater
is still running.
Link to this section Functions
Link to this function
done?(generater)
Check if the generater
is done.
Link to this function
next(g, v \\ nil)
Get next value form the generater g
.
Link to this function
running?(generater)
Check if the generater
is still running.