Add search-all function to util.lisp for 2024
This commit is contained in:
@@ -5,7 +5,16 @@
|
|||||||
appending `((_ ,f)))
|
appending `((_ ,f)))
|
||||||
_)))
|
_)))
|
||||||
|
|
||||||
(defun zip (a b)
|
(defun search-all (substr str &optional acc len)
|
||||||
(loop for i in a
|
(let ((x (search substr str))
|
||||||
for j in b
|
(len (or len 0)))
|
||||||
collect (cons i j)))
|
(if (null x)
|
||||||
|
(reverse acc)
|
||||||
|
(search-all substr (subseq str (1+ x))
|
||||||
|
(cons (+ x len) acc)
|
||||||
|
(+ len x 1)))))
|
||||||
|
|
||||||
|
(defun zip (a b)
|
||||||
|
(loop for i in a
|
||||||
|
for j in b
|
||||||
|
collect (cons i j)))
|
||||||
|
|||||||
Reference in New Issue
Block a user