updated to week 6 minus week 5 oops

This commit is contained in:
tA 2019-10-31 22:03:29 +13:00
parent f116fd9bab
commit 5e8d2432b3
3 changed files with 92 additions and 0 deletions

24
201/week6/lib/dfs.hoon Normal file
View file

@ -0,0 +1,24 @@
:: depth first library
::
|%
++ traverse
|= t=(tree @)
^- (list @)
?~ t
~
%+ weld
(traverse l.t)
%+ weld
(traverse r.t)
[n.t ~]
++ search
|= [t=(tree @) x=@]
^- ?
?~ t
%.n
?| (search l.t x)
(search r.t x)
=(n.t x)
==
--