aboutsummaryrefslogtreecommitdiff
path: root/2024/util.lisp
blob: 11ec230662cb098a5a9e0493bf7005a3035f5ab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(defmacro --> (first &rest functions)
  (if (null functions)
      first
      `(let* ,(loop :for f :in (cons first functions)
                    appending `((_ ,f)))
         _)))

(defun search-all (substr str &optional acc len)
  (let ((x (search substr str))
        (len (or len 0)))
    (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)))