Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active May 26, 2017 15:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
(defn head-and-tail
[[x & xs]] ; Destructuring of the input container
{:head x ; `x` contains the first element
:tail xs}) ; `xs` contains the remaining elements
; Example call
(head-and-tail [1 2 3])
=> {:head 1, :tail (2 3)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment