Skip to content

Instantly share code, notes, and snippets.

@redraiment
Created December 25, 2012 02:56
Show Gist options
  • Save redraiment/4371447 to your computer and use it in GitHub Desktop.
Save redraiment/4371447 to your computer and use it in GitHub Desktop.
Returns a sub list.
(defmacro sublist (1st start &optional (size nil))
"(sublist start size?)
Returns a list of the items in vector from start (inclusive)
to start + size (exclusive). If size is not supplied,
defaults to end of list."
`(loop for item in (nthcdr ,start ,1st)
,@(if size
`(for i from 1 to ,size))
collect item))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment