3 implementations of take:
#1
/digego/extempore/tree/v0.8.9/libs/core/pattern-language.xtm ·
#2
/digego/extempore/tree/v0.8.9/libs/core/adt.xtm ·
#3
/lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
(bind-func take:[List{!a}*,List{!a}*,i64]*
"returns a copy of the first n elements of lst"
(lambda (lst n)
(let ((newlst (list))
(oldlst lst)
(count 0))
(while (and (< count n)
(not (null? oldlst)))
(set! newlst (cons (car oldlst) newlst))
(set! oldlst (cdr oldlst))
(set! count (+ count 1)))
(reverse newlst))))