feat: implement split function.
Takes a list and an integer, splits off n elements from the list and returns a list where the first element contains the first n elements of the original list, the cdr of that list contains the rest.
This commit is contained in:
parent
49298a3ca2
commit
49bacbffde
1 changed files with 12 additions and 0 deletions
|
@ -62,6 +62,18 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
|
|||
(rev-helper lst '())))
|
||||
"""
|
||||
);
|
||||
this["split"] = e.eval(
|
||||
"""
|
||||
(lambda
|
||||
(lst n)
|
||||
(if
|
||||
(or (= n 0) (null lst))
|
||||
(cons '() lst)
|
||||
(let
|
||||
(s (split (cdr lst) (- n 1)))
|
||||
(cons (cons (car lst) (car s)) (cdr s)))))
|
||||
"""
|
||||
);
|
||||
this["qsort"] = e.eval(
|
||||
"""
|
||||
(lambda
|
||||
|
|
Loading…
Add table
Reference in a new issue