Implement split function.
Given a list and index into that list, return a cons where the car is all elements up to that index (exclusive) and the cdr is the rest of the list.
This commit is contained in:
@@ -32,3 +32,7 @@ each member is STEP distance apart."
|
||||
|
||||
(fn take (n lst) (-> (fixnum list) list)
|
||||
(subseq lst 0 n))
|
||||
|
||||
(fn split (n lst) (-> (fixnum list) list)
|
||||
(cons (take n lst)
|
||||
(subseq lst n)))
|
||||
|
||||
Reference in New Issue
Block a user