3 ms·
'Doing a binary tree'? You mean visiting every node? define walk-tree (tree fn &optional remaining-branches) match tree (Leaf l) -> funcall
by tmtvl 2y ago
'Doing a binary tree'? You mean visiting every node?
define walk-tree (tree fn &optional remaining-branches)
match tree
(Leaf l) ->
funcall fn l
if remaining-branches
walk-tree (first remaining-branches) fn (rest remaining-branches)
(Tree t r l) ->
funcall fn t
walk-tree r fn (push l remaining-branches)