My work for Hoon 101. Will remain private until the class is over.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

43 Zeilen
683B

  1. :: Hoon 201 - Week 2
  2. :: ~bannum-magtus || s@p7.co.nz
  3. ::
  4. :: i could not figure out how to
  5. :: cast the output of a wet gate
  6. :: to a list of the same type :(
  7. ::
  8. :- %say
  9. |= [* [t=(tree @) x=@ ~] *]
  10. :- %noun
  11. ^- [? (list @)]
  12. =<
  13. :- (dfs-search t x) (dfs t)
  14. |%
  15. ++ dfs
  16. |= t=(tree @)
  17. ^- (list @)
  18. ?~ t
  19. ~
  20. %+ weld
  21. (dfs l.t)
  22. %+ weld
  23. (dfs r.t)
  24. [n.t ~]
  25. ++ dfs-search
  26. |= [t=(tree @) x=@]
  27. ^- ?
  28. ?~ t
  29. %.n
  30. ?| (dfs-search l.t x)
  31. (dfs-search r.t x)
  32. =(n.t x)
  33. ==
  34. :: i assume ?| will stop as
  35. :: soon as it sees a true,
  36. :: otherwise below is better
  37. ::
  38. ::?: (dfs-search l.t x) %.y
  39. ::?: (dfs-search r.t x) %.y
  40. ::=(x n.t)
  41. --