Skip to content

Instantly share code, notes, and snippets.

@noahlz
Created May 3, 2013 15:49
Show Gist options
  • Save noahlz/5510191 to your computer and use it in GitHub Desktop.
Save noahlz/5510191 to your computer and use it in GitHub Desktop.
concat vs. conj vs. cons vs. list vs. list*
user=> (concat '(1 2 3) '(4 5 6))
(1 2 3 4 5 6)
user=> (conj '(1 2 3) '(4 5 6))
((4 5 6) 1 2 3)
user=> (cons '(1 2 3) '(4 5 6))
((1 2 3) 4 5 6)
user=> (list '(1 2 3) '(4 5 6))
((1 2 3) (4 5 6))
user=> (list* '(1 2 3) '(4 5 6))
((1 2 3) 4 5 6)
user=> (concat [1 2 3] [4 5 6])
(1 2 3 4 5 6)
user=> (conj [1 2 3] [4 5 6])
[1 2 3 [4 5 6]]
user=> (cons [1 2 3] [4 5 6])
([1 2 3] 4 5 6)
user=> (list [1 2 3] [4 5 6])
([1 2 3] [4 5 6])
user=> (list* [1 2 3] [4 5 6])
([1 2 3] 4 5 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment