Implement a "take" function to read subsequences of a list

Basically a wrapper over subseq but for when using `->>` as the list
is the last parameter.
This commit is contained in:
2025-02-10 07:23:02 +00:00
parent b29855047b
commit 2d49ed25ac
2 changed files with 6 additions and 3 deletions

View File

@@ -29,3 +29,6 @@ each member is STEP distance apart."
(fn parse-integer* (inp) (-> (string) (or integer list))
(parse-integer inp :junk-allowed t))
(fn take (n lst) (-> (fixnum list) list)
(subseq lst 0 n))

View File

@@ -21,15 +21,15 @@
(:use :cl)
(:export
:_ :--> :->>
:while
:-> :fn
:while
:$))
(defpackage lib.functions
(:use :cl :lib.macros)
(:export
:range
:parse-integer*))
:parse-integer*
:range :take))
(defpackage main
(:use :cl :lib.macros)