Skip to content

Instantly share code, notes, and snippets.

@ionrock
Created January 28, 2014 03:19
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 ionrock/8661766 to your computer and use it in GitHub Desktop.
Save ionrock/8661766 to your computer and use it in GitHub Desktop.
craps.core=> (def my-list '(1 2 3 4))
#'craps.core/my-list
craps.core=> (map println my-list)
(1
2
nil 3
nil 4
nil nil)
craps.core=> (map print my-list)
(12nil 3nil 4nil nil)
craps.core=> (def my-list [1 2 3 4])
#'craps.core/my-list
craps.core=> (map print my-list)
(1234nil nil nil nil)
craps.core=>
@ionrock
Copy link
Author

ionrock commented Jan 28, 2014

So, the nils show up b/c map is lazy. The output is being interspersed with the resulting sequence. Since println doesn't return anything, you get '(nil nil nil nil).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment