aboutsummaryrefslogtreecommitdiff
path: root/2022
diff options
context:
space:
mode:
Diffstat (limited to '2022')
-rw-r--r--2022/lib.lisp6
-rw-r--r--2022/puzzle-8.lisp6
2 files changed, 3 insertions, 9 deletions
diff --git a/2022/lib.lisp b/2022/lib.lisp
index 1d81219..6c55508 100644
--- a/2022/lib.lisp
+++ b/2022/lib.lisp
@@ -29,12 +29,6 @@
(defun id (x) x)
-(defun all (pred lst)
- (if (not (cdr lst))
- (funcall pred (car lst))
- (and (funcall pred (car lst))
- (all pred (cdr lst)))))
-
(defun remove-nth (n lst)
(if (or (null lst) (= n 0))
(cdr lst)
diff --git a/2022/puzzle-8.lisp b/2022/puzzle-8.lisp
index 85fd1ae..54aca27 100644
--- a/2022/puzzle-8.lisp
+++ b/2022/puzzle-8.lisp
@@ -23,7 +23,7 @@
(defun is-visible? (x y)
(if (or (= x 0) (= x (- n-trees 1))
- (= y 0) (= y (- n-trees 1)))
+ (= y 0) (= y (- n-trees 1)))
t
(let* ((tree (get-tree x y))
(lt-tree? (lambda (a) (< a tree)))
@@ -34,8 +34,8 @@
(col-top (subseq col 0 y))
(col-bottom (subseq col (+ y 1))))
(some #'id
- (mapcar (lambda (x) (all lt-tree? x))
- (list row-left row-right col-top col-bottom))))))
+ (mapcar (lambda (x) (every lt-tree? x))
+ (list row-left row-right col-top col-bottom))))))
(defun how-many-visible ()
(loop