Created
December 25, 2012 02:56
-
-
Save redraiment/4371447 to your computer and use it in GitHub Desktop.
Returns a sub list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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