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:
2025-02-10 07:25:43 +00:00
parent 2d49ed25ac
commit 279437cb81
2 changed files with 5 additions and 1 deletions

View File

@@ -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)))