Skip to content

Instantly share code, notes, and snippets.

@RutledgePaulV
Created April 13, 2020 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RutledgePaulV/bd4a60062bf5f052b7eb6eb9e11d8749 to your computer and use it in GitHub Desktop.
Save RutledgePaulV/bd4a60062bf5f052b7eb6eb9e11d8749 to your computer and use it in GitHub Desktop.
(defn tree-seq-bf [branch? children root]
(letfn [(walk [node]
(when (branch? node)
(lazy-seq
(let [children (children node)]
(lazy-cat children (mapcat walk children))))))]
(cons root (walk root))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment