Skip to content

Instantly share code, notes, and snippets.

@iku000888
Last active June 28, 2017 23:58
Show Gist options
  • Save iku000888/a158d022043e66cf18c7916cfab8c9ed to your computer and use it in GitHub Desktop.
Save iku000888/a158d022043e66cf18c7916cfab8c9ed to your computer and use it in GitHub Desktop.
;; conj to a list
(conj '(1 2 3 4) 5) => (5 1 2 3 4)
;; conj to a vector
(conj [1 2 3 4] 5) => [1 2 3 4 5]
(-> [1 2 3 4]
(conj 5)
peek) =>5
(-> '(1 2 3 4)
(conj 5)
peek) => 5
;; popping from a vector
(-> [1 2 3 4]
(conj 5)
pop) => [1 2 3 4]
;; popping from a list
(-> '(1 2 3 4)
(conj 5)
pop) => (1 2 3 4)
(time
(last [1 2 3 4 5 6 7 8 9]))
;; "Elapsed time: 0.171368 msecs"
(time
(peek [1 2 3 4 5 6 7 8 9]))
;; "Elapsed time: 0.066708 msecs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment