diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/coll/tree/rose.lux | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/stdlib/source/lux/data/coll/tree/rose.lux b/stdlib/source/lux/data/coll/tree/rose.lux index 5493d6692..b4ac0c313 100644 --- a/stdlib/source/lux/data/coll/tree/rose.lux +++ b/stdlib/source/lux/data/coll/tree/rose.lux @@ -3,8 +3,9 @@ (lux (control functor monad eq - ["p" parser]) - (data (coll [list "L/" Monad<List>])) + ["p" parser] + fold) + (data (coll [list "L/" Monad<List> Fold<List>])) [macro] (macro [code] ["s" syntax #+ syntax: Syntax]))) @@ -63,3 +64,10 @@ {#value (f (get@ #value fa)) #children (L/map (map f) (get@ #children fa))})) + +(struct: #export _ (Fold Tree) + (def: (fold f init tree) + (L/fold (function [tree' init'] (fold f init' tree')) + (f (get@ #value tree) + init) + (get@ #children tree)))) |