Skip to content

Commit d309bf9

Browse files
committed
Unbreak new tests. For #2
1 parent 10cce53 commit d309bf9

File tree

5 files changed

+21
-49
lines changed

5 files changed

+21
-49
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ RUN ecl --load quicklisp.lisp \
1515
RUN echo | ecl --load /home/janice/quicklisp/setup.lisp --eval '(ql:add-to-init-file)'
1616
RUN echo | sbcl --load /home/janice/quicklisp/setup.lisp --eval '(ql:add-to-init-file)' --quit
1717

18+
RUN sbcl --eval '(ql-dist:install-dist "http://dist.ultralisp.org/" :prompt nil)'
19+
1820
ENV LISP_HOME=/home/janice/quicklisp/local-projects
1921
WORKDIR /home/janice/hbook
2022

hbook.asd

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
:license "FIXME"
66
:serial t
77
:in-order-to ((asdf:test-op (asdf:test-op :hbook/test)))
8-
:depends-on (:arrows
9-
;; FIXME: Though not an explicit run-time dependency,
10-
;; for some reason I needed to add this for GitHub
11-
;; Action CI build to succeed. This merits more
12-
;; investigation:
13-
:1am)
8+
:depends-on (:cl-oju :1am)
149
:components ((:module "src"
1510
:serial t
1611
:components ((:file "package")
@@ -20,7 +15,7 @@
2015
:description "FIXME"
2116
:author "FIXME"
2217
:license "FIXME"
23-
:depends-on (:hbook :1am)
18+
:depends-on (:hbook :1am :cl-oju)
2419
:serial t
2520
:components ((:module "test"
2621
:serial t

src/main.lisp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
(in-package #:hbook)
22

33
;; Utilities
4-
(defmacro comment (&rest x)
5-
(declare (ignore x)))
6-
74
(defun minmax (list)
85
(loop for el in list
96
maximizing el into max
@@ -138,6 +135,9 @@
138135
do (setf acc (dn acc))
139136
finally (return acc)))
140137

138+
(defmacro comment (&rest x)
139+
(declare (ignore x)))
140+
141141
(comment
142142
(dr 1)
143143
(dr 2)

test/package.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
(defpackage :hbook.test
2-
(:use :cl :1am :hbook)
2+
(:use :cl :1am :hbook :cl-oju)
33
(:export :run-tests))

test/test.lisp

+13-38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(defpackage :hbook.test
2-
(:use :cl :1am :hbook)
2+
(:use :cl :1am :hbook :cl-oju)
33
(:export :run-tests))
44

55
(in-package #:hbook.test)
@@ -29,44 +29,19 @@
2929
(loop for el in '(2 3 4 5 6 7 8 9 10 11 12)
3030
collect (bin-index 11 2 12 el)))))
3131

32-
;; TODO: Use cl-oju?
33-
(defun take (n l)
34-
"
35-
Take the first `n` items from `l`.
36-
"
37-
(subseq l 0 n))
32+
(eval-when (:compile-toplevel :load-toplevel :execute)
33+
(defun apply-bindings (bindings case expr)
34+
"
35+
(apply-bindings '(x y) '(2 3) '(+ x y))
3836
39-
(defun partition-n (cell-size step-size lst)
40-
"
41-
Analog of Clojure's `partition` function with explicit
42-
step size and padding value.
43-
44-
(partition-n 2 2 '(eenie meanie
45-
miney moe))
46-
;;=>
47-
'((EENIE MEANIE) (MINEY MOE))
48-
"
49-
(let ((ret nil))
50-
(loop for cell on lst
51-
by #'(lambda (lst1) (nthcdr step-size lst1))
52-
do (let ((this (take cell-size cell)))
53-
(when (= (length (the list this))
54-
(the fixnum cell-size))
55-
(push (take cell-size cell) ret))))
56-
(nreverse ret)))
57-
58-
(defun apply-bindings (bindings case expr)
59-
"
60-
(apply-bindings '(x y) '(2 3) '(+ x y))
61-
62-
;;=>
63-
'(+ 2 3)
64-
"
65-
(loop with ret = expr
66-
for b in bindings
67-
for c in case
68-
do (setf ret (subst c b ret))
69-
finally (return ret)))
37+
;;=>
38+
'(+ 2 3)
39+
"
40+
(loop with ret = expr
41+
for b in bindings
42+
for c in case
43+
do (setf ret (subst c b ret))
44+
finally (return ret))))
7045

7146
(defmacro are (argv expr &rest cases)
7247
"

0 commit comments

Comments
 (0)