Created
April 13, 2020 03:39
-
-
Save RutledgePaulV/bd4a60062bf5f052b7eb6eb9e11d8749 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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