Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created February 19, 2011 18:30
Show Gist options
  • Select an option

  • Save swannodette/835244 to your computer and use it in GitHub Desktop.

Select an option

Save swannodette/835244 to your computer and use it in GitHub Desktop.
(defn reverse*-cps [x k]
(cond
(nil? (seq x))
(trampoline #(apply-cont k '[]))
(seq? (first x))
(recur (rest x)
(fn [new-tail]
#(reverse*-cps (first x) ; <-- HERE
(fn [new-head]
(snoc-cps new-tail new-head k)))))
:else (recur (rest x)
(fn [new-tail]
(snoc-cps new-tail (first x) k)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment