Skip to content

Instantly share code, notes, and snippets.

@pjstadig
Created June 3, 2015 13:16
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 pjstadig/295d8825c13646b3e8ff to your computer and use it in GitHub Desktop.
Save pjstadig/295d8825c13646b3e8ff to your computer and use it in GitHub Desktop.
Loop destructuring holds the head of a sequence
;;;; This
(loop [[chunk & chunks] (partition-all 10000 foo)]
(when (seq chunk)
(do-something chunk)
(recur chunks)))
;;;; Macro exapnds to this
(let [G__3399 (partition-all 10000 foo)
[chunk & chunks] G__3399]
(loop* [G__3399 G__3399]
(let [[chunk & chunks] G__3399]
(when (seq chunk)
(do-something chunk)
(recur chunks)))))
;;;; Which holds the head of the partition-all sequence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment