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)
|
(fn take (n lst) (-> (fixnum list) list)
|
||||||
(subseq lst 0 n))
|
(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)
|
(:use :cl :lib.macros)
|
||||||
(:export
|
(:export
|
||||||
:parse-integer*
|
:parse-integer*
|
||||||
:range :take))
|
:range :take :split))
|
||||||
|
|
||||||
(defpackage main
|
(defpackage main
|
||||||
(:use :cl :lib.macros)
|
(:use :cl :lib.macros)
|
||||||
|
|||||||
Reference in New Issue
Block a user