Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active May 26, 2017 15:09
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 deque-blog/3089ca9283df85c90ab55391a182847c to your computer and use it in GitHub Desktop.
Save deque-blog/3089ca9283df85c90ab55391a182847c to your computer and use it in GitHub Desktop.
(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