|
|
|
@ -128,13 +128,19 @@
|
|
|
|
|
(index (+ max i) max)
|
|
|
|
|
(mod i max)))
|
|
|
|
|
|
|
|
|
|
(defun slice (seq start end)
|
|
|
|
|
"Like JS slice()?"
|
|
|
|
|
(defun slice-list (seq start &optional (end -1))
|
|
|
|
|
"Like JS slice() for list"
|
|
|
|
|
(let ((start (index start (length seq)))
|
|
|
|
|
(end (index end (length seq))))
|
|
|
|
|
(rplacd (nthcdr end seq) nil)
|
|
|
|
|
(nthcdr start seq)))
|
|
|
|
|
|
|
|
|
|
(defun slice (seq start &optional (end -1))
|
|
|
|
|
"Like JS slice()?"
|
|
|
|
|
(let ((start (index start (length seq)))
|
|
|
|
|
(end (index end (1+ (length seq)))))
|
|
|
|
|
(subseq seq start end)))
|
|
|
|
|
|
|
|
|
|
(defun flatten-top-level (li)
|
|
|
|
|
"'( (1 2) 3 4 (5 6 7) (8) ((9 10))) -> ( 1 2 3 4 5 6 7 8 (9 10))"
|
|
|
|
|
(mapcan #'(lambda (x)
|
|
|
|
|