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)))
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
(:use :cl :lib.macros)
|
||||
(:export
|
||||
:parse-integer*
|
||||
:range :take))
|
||||
:range :take :split))
|
||||
|
||||
(defpackage main
|
||||
(:use :cl :lib.macros)
|
||||
|
||||
Reference in New Issue
Block a user