News for hackers. Stuff that matters.
Re:Don't Implement Unification by Recursion by tmtvl on Tuesday October 29, 2024 @09:59AM (#41983916)
'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)

There are no comments on this comment yet.