chickadee » ck-macros » c-take2

(c-take1 L) → listsyntax
(c-take2 L) → listsyntax
(c-take3 L) → listsyntax
(c-take4 L) → listsyntax
(c-take5 L) → listsyntax

Yields a list containing a predefined number of items from the front of the given list. Fails if the list is too short. See also c-utake.

Analogous to (take L N) from SRFI 1.

(ck () (c-quote (c-take1 '(a b c d e f g))))  ; ==> '(a)
(ck () (c-quote (c-take2 '(a b c d e f g))))  ; ==> '(a b)
(ck () (c-quote (c-take3 '(a b c d e f g))))  ; ==> '(a b c)
(ck () (c-quote (c-take4 '(a b c d e f g))))  ; ==> '(a b c d)
(ck () (c-quote (c-take5 '(a b c d e f g))))  ; ==> '(a b c d e)