Skip to content

Instantly share code, notes, and snippets.

@LispyAriaro
Last active August 29, 2015 14:15
Show Gist options
  • Save LispyAriaro/6708133a00eab98fa0c5 to your computer and use it in GitHub Desktop.
Save LispyAriaro/6708133a00eab98fa0c5 to your computer and use it in GitHub Desktop.
Reversing a list without using the reverse function
;;;puttin letfn to work
;;;reverse without the 'reverse' function
(fn[lst]
(letfn [(my-fun [lst so-far]
(if (empty? lst)
so-far
(recur (butlast lst)
(conj so-far (last lst)))))]
(println (my-fun lst []))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment