Created
June 24, 2011 21:44
-
-
Save anonymous/1045758 to your computer and use it in GitHub Desktop.
iterate each item in a list once
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
(def examplelist '(1 2 3 4 5)) | |
(def newlist ()) | |
(if (<= 0 (count examplelist)) | |
;figure out a way to use let instead of an inline def here | |
(do (conj newlist (+ 1 (peek examplelist))) (def examplelist (pop examplelist)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment