summaryrefslogtreecommitdiff
path: root/util.lisp
blob: 3369a031c9e60c598d7d61f247b7d7f68d5f7a62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(defmacro inc (x &optional (val 1))
  `(setf ,x (+ ,val ,x)))

;; For system arguments
(defmacro when-option ((options opt) &body body)
  `(let ((it (getf ,options ,opt)))
     (when it
       ,@body)))

(defun max-length (lists)
  (reduce (lambda (a x) (max a x)) (mapcar #'length lists)))

(defun not-empty-string (str)
  (not (zerop (length str))))