updated to week 6 minus week 5 oops
This commit is contained in:
parent
f116fd9bab
commit
5e8d2432b3
3 changed files with 92 additions and 0 deletions
24
201/week6/lib/dfs.hoon
Normal file
24
201/week6/lib/dfs.hoon
Normal 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)
|
||||
==
|
||||
--
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue