Created
October 22, 2017 20:21
-
-
Save chakravala/a5eb66b5af066233797f1d3bfe3edd84 to your computer and use it in GitHub Desktop.
Creates iterable function object for Dendriform.Grove
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dendriform, ResumableFunctions | |
@resumable function trees(g::Union{Grove,PBTree}) | |
typeof(g) == PBTree && return ResumableFunctions.@yield g | |
for i ∈ 1:g.size-1 | |
ResumableFunctions.@yield PBTree(g.Y[i,:]) | |
end | |
return PBTree(g.Y[end,:]) | |
end | |
import Base.convert | |
convert(::Type{Array{PBTree,1}},g::Grove) = [trees(g)...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment