Lots of new unit tests.
This commit is contained in:
parent
01e4572119
commit
7c4d3668a8
|
@ -130,19 +130,19 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
042 [symbol]
|
||||
</span><br/>
|
||||
<span class="partial" title="4 out of 5 forms covered">
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
043 (when (:strict *options*)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
044 (throw (ex-info (format "%s ne āfand innan Lisp 1.5" symbol)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
045 {:type :strict
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
046 :phase :host
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
047 :function symbol})))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -283,19 +283,19 @@
|
|||
<span class="covered" title="4 out of 4 forms covered">
|
||||
093 (empty? path) l
|
||||
</span><br/>
|
||||
<span class="partial" title="6 out of 13 forms covered">
|
||||
<span class="covered" title="13 out of 13 forms covered">
|
||||
094 (not (instance? ConsCell l)) (throw (ex-info (str "Ne liste: "
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
095 l "; " (type l))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 8 forms covered">
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
096 {:phase :eval
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
097 :function "universal access function"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
098 :args [l path]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -310,19 +310,19 @@
|
|||
<span class="covered" title="6 out of 6 forms covered">
|
||||
102 \d (uaf (.getCdr l) (butlast path))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
103 (throw (ex-info (str "uaf: unexpected letter in path (only `a` and `d` permitted): "
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
104 (last path))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 8 forms covered">
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
105 {:phase :eval
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
106 :function "universal access function"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
107 :args [l path]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -568,7 +568,7 @@
|
|||
<span class="covered" title="1 out of 1 forms covered">
|
||||
188 (if
|
||||
</span><br/>
|
||||
<span class="partial" title="11 out of 13 forms covered">
|
||||
<span class="partial" title="12 out of 13 forms covered">
|
||||
189 (or
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
|
@ -580,7 +580,7 @@
|
|||
<span class="covered" title="3 out of 3 forms covered">
|
||||
192 (symbol? value)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
193 (= value NIL))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
|
@ -619,13 +619,13 @@
|
|||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
205 any))))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
206 (throw (ex-info
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
207 (str "Un-ġefōg þing in RPLACD: `" value "` (" (type value) ")")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 10 forms covered">
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
208 {:cause :bad-value
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -634,19 +634,19 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
210 :function :rplacd
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
211 :args (list cell value)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
212 :type :beowulf})))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
213 (throw (ex-info
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
214 (str "Uncynlic miercels in RPLACD: `" cell "` (" (type cell) ")")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 10 forms covered">
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
215 {:cause :bad-cell
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -655,7 +655,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
217 :detail :rplacd
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
218 :args (list cell value)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -682,7 +682,7 @@
|
|||
<span class="blank" title="0 out of 0 forms covered">
|
||||
226
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 36 forms covered">
|
||||
<span class="covered" title="36 out of 36 forms covered">
|
||||
227 (defmacro NULL
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -691,13 +691,13 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
229 [x]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
230 `(if (= ~x NIL) T F))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
231
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 36 forms covered">
|
||||
<span class="covered" title="36 out of 36 forms covered">
|
||||
232 (defmacro NILP
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -706,7 +706,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
234 [x]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
235 `(if (= ~x NIL) T NIL))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -847,13 +847,13 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
281 ;; (println " filtered: " (seq (filter #{F NIL} args)))
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 7 forms covered">
|
||||
<span class="partial" title="6 out of 7 forms covered">
|
||||
282 (cond (= NIL args) T
|
||||
</span><br/>
|
||||
<span class="covered" title="14 out of 14 forms covered">
|
||||
283 (seq? args) (if (seq (filter #{F NIL} args)) F T)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
284 :else T))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -889,13 +889,13 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
295 ;; (println " filtered: " (seq (remove #{F NIL} args)))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
<span class="partial" title="6 out of 7 forms covered">
|
||||
296 (cond (= NIL args) F
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 14 forms covered">
|
||||
<span class="covered" title="14 out of 14 forms covered">
|
||||
297 (seq? args) (if (seq (remove #{F NIL} args)) T F)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
298 :else F))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1078,7 +1078,7 @@
|
|||
<span class="covered" title="5 out of 5 forms covered">
|
||||
358 (let [p (apply * args)]
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 7 forms covered">
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
359 (if (integer? p) p (float p))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1093,7 +1093,7 @@
|
|||
<span class="covered" title="4 out of 4 forms covered">
|
||||
363 (let [d (- x y)]
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 7 forms covered">
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
364 (if (integer? d) d (float d))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1153,7 +1153,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
383 [x]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
384 (dec x))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1165,7 +1165,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
387 [x]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
388 (if (integer? x) T F))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1189,7 +1189,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
395 [x y]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
396 (if (< x y) T F))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1201,7 +1201,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
399 [x y]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
400 (if (> x y) T F))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1237,7 +1237,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
411 [& args]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 14 forms covered">
|
||||
<span class="covered" title="14 out of 14 forms covered">
|
||||
412 (throw (ex-info "LISP STÆFLEAHTER" {:args args
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
|
@ -1249,7 +1249,7 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
415 :type :lisp
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 8 forms covered">
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
416 :code (or (first args) 'A1)})))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
|
@ -1334,7 +1334,7 @@
|
|||
443 [target plist]
|
||||
</span><br/>
|
||||
<span class="covered" title="13 out of 13 forms covered">
|
||||
444 (if (and (instance? ConsCell plist)(even? (count plist)))
|
||||
444 (if (and (instance? ConsCell plist) (even? (count plist)))
|
||||
</span><br/>
|
||||
<span class="partial" title="6 out of 7 forms covered">
|
||||
445 (cond (= plist NIL) NIL
|
||||
|
@ -1558,215 +1558,218 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
518 [a-list indicator]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
519 (map
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
519 (doall
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
520 #(PUT (CAR %) indicator (CDR %))
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
520 (map
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 14 forms covered">
|
||||
521 #(when (PUT (CAR %) indicator (CDR %)) (CAR %))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
521 a-list))
|
||||
522 a-list)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
522
|
||||
523
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
523 (defn DEFINE
|
||||
524 (defn DEFINE
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
524 "Bootstrap-only version of `DEFINE` which, post boostrap, can be overwritten
|
||||
525 "Bootstrap-only version of `DEFINE` which, post boostrap, can be overwritten
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
525 in LISP.
|
||||
526 in LISP.
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
526
|
||||
527
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
527 The single argument to `DEFINE` should be an association list of symbols to
|
||||
528 The single argument to `DEFINE` should be an association list of symbols to
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
528 lambda functions. See page 58 of the manual."
|
||||
529 lambda functions. See page 58 of the manual."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
529 [a-list]
|
||||
530 [a-list]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
530 (DEFLIST a-list 'EXPR))
|
||||
531 (DEFLIST a-list 'EXPR))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
531
|
||||
532
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
532 (defn SET
|
||||
533 (defn SET
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
533 "Implementation of SET in Clojure. Add to the `oblist` a binding of the
|
||||
534 "Implementation of SET in Clojure. Add to the `oblist` a binding of the
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
534 value of `var` to the value of `val`. NOTE WELL: this is not SETQ!"
|
||||
535 value of `var` to the value of `val`. NOTE WELL: this is not SETQ!"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
535 [symbol val]
|
||||
536 [symbol val]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
536 (PUT symbol 'APVAL val))
|
||||
537 (PUT symbol 'APVAL val))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
537
|
||||
538
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
538 ;;;; TRACE and friends ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
539 ;;;; TRACE and friends ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
539
|
||||
540
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
540 (def traced-symbols
|
||||
541 (def traced-symbols
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
541 "Symbols currently being traced."
|
||||
542 "Symbols currently being traced."
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
542 (atom #{}))
|
||||
543 (atom #{}))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
543
|
||||
544
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
544 (defn traced?
|
||||
545 (defn traced?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
545 "Return `true` iff `s` is a symbol currently being traced, else `nil`."
|
||||
546 "Return `true` iff `s` is a symbol currently being traced, else `nil`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
546 [s]
|
||||
547 [s]
|
||||
</span><br/>
|
||||
<span class="partial" title="7 out of 8 forms covered">
|
||||
547 (try (contains? @traced-symbols s)
|
||||
548 (try (contains? @traced-symbols s)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
548 (catch Throwable _ nil)))
|
||||
549 (catch Throwable _ nil)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
549
|
||||
550
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
550 (defn TRACE
|
||||
551 (defn TRACE
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
551 "Add this `s` to the set of symbols currently being traced. If `s`
|
||||
552 "Add this `s` to the set of symbols currently being traced. If `s`
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
552 is not a symbol or sequence of symbols, does nothing."
|
||||
553 is not a symbol or sequence of symbols, does nothing."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
553 [s]
|
||||
554 [s]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
554 (swap! traced-symbols
|
||||
555 (swap! traced-symbols
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
555 #(cond
|
||||
556 #(cond
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
556 (symbol? s) (conj % s)
|
||||
557 (symbol? s) (conj % s)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 17 forms covered">
|
||||
557 (and (seq? s) (every? symbol? s)) (union % (set s))
|
||||
558 (and (seq? s) (every? symbol? s)) (union % (set s))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
558 :else %)))
|
||||
559 :else %)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
559
|
||||
560
|
||||
</span><br/>
|
||||
<span class="partial" title="1 out of 3 forms covered">
|
||||
560 (defn UNTRACE
|
||||
561 (defn UNTRACE
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
561 "Remove this `s` from the set of symbols currently being traced. If `s`
|
||||
562 "Remove this `s` from the set of symbols currently being traced. If `s`
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
562 is not a symbol or sequence of symbols, does nothing."
|
||||
563 is not a symbol or sequence of symbols, does nothing."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
563 [s]
|
||||
564 [s]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
564 (cond
|
||||
565 (cond
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 16 forms covered">
|
||||
565 (symbol? s) (swap! traced-symbols #(set (remove (fn [x] (= s x)) %)))
|
||||
566 (symbol? s) (swap! traced-symbols #(set (remove (fn [x] (= s x)) %)))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 15 forms covered">
|
||||
566 (and (seq? s) (every? symbol? s)) (map UNTRACE s))
|
||||
567 (and (seq? s) (every? symbol? s)) (map UNTRACE s))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
567 @traced-symbols)
|
||||
568 @traced-symbols)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
568
|
||||
569
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
569 ;;;; Extensions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
570 ;;;; Extensions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
570
|
||||
571
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
571 (defn DOC
|
||||
572 (defn DOC
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
572 "Open the page for this `symbol` in the Lisp 1.5 manual, if known, in the
|
||||
573 "Open the page for this `symbol` in the Lisp 1.5 manual, if known, in the
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
573 default web browser.
|
||||
574 default web browser.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
574
|
||||
575
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
575 **NOTE THAT** this is an extension function, not available in strct mode."
|
||||
576 **NOTE THAT** this is an extension function, not available in strct mode."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
576 [symbol]
|
||||
577 [symbol]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
577 (when (lax? 'DOC)
|
||||
578 (when (lax? 'DOC)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
578 (open-doc symbol)))
|
||||
579 (open-doc symbol)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
579
|
||||
580
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
580 (defn CONSP
|
||||
581 (defn CONSP
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
581 "Return `T` if object `o` is a cons cell, else `F`.
|
||||
582 "Return `T` if object `o` is a cons cell, else `F`.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
582
|
||||
583
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
583 **NOTE THAT** this is an extension function, not available in strct mode.
|
||||
584 **NOTE THAT** this is an extension function, not available in strct mode.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
584 I believe that Lisp 1.5 did not have any mechanism for testing whether an
|
||||
585 I believe that Lisp 1.5 did not have any mechanism for testing whether an
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
585 argument was, or was not, a cons cell."
|
||||
586 argument was, or was not, a cons cell."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
586 [o]
|
||||
587 [o]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
587 (when (lax? 'CONSP)
|
||||
588 (when (lax? 'CONSP)
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
588 (if (instance? ConsCell o) 'T 'F)))
|
||||
589 (if (instance? ConsCell o) 'T 'F)))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -67,20 +67,20 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><a href="beowulf/host.clj.html">beowulf.host</a></td><td class="with-bar"><div class="covered"
|
||||
style="width:46.61776691116545%;
|
||||
float:left;"> 1144 </div><div class="not-covered"
|
||||
style="width:53.38223308883455%;
|
||||
float:left;"> 1310 </div></td>
|
||||
<td class="with-number">46.62 %</td>
|
||||
style="width:56.44047135310849%;
|
||||
float:left;"> 1389 </div><div class="not-covered"
|
||||
style="width:43.55952864689151%;
|
||||
float:left;"> 1072 </div></td>
|
||||
<td class="with-number">56.44 %</td>
|
||||
<td class="with-bar"><div class="covered"
|
||||
style="width:61.97718631178707%;
|
||||
float:left;"> 163 </div><div class="partial"
|
||||
style="width:14.068441064638783%;
|
||||
float:left;"> 37 </div><div class="not-covered"
|
||||
style="width:23.954372623574145%;
|
||||
float:left;"> 63 </div></td>
|
||||
<td class="with-number">76.05 %</td>
|
||||
<td class="with-number">588</td><td class="with-number">67</td><td class="with-number">263</td>
|
||||
style="width:75.37878787878788%;
|
||||
float:left;"> 199 </div><div class="partial"
|
||||
style="width:12.121212121212121%;
|
||||
float:left;"> 32 </div><div class="not-covered"
|
||||
style="width:12.5%;
|
||||
float:left;"> 33 </div></td>
|
||||
<td class="with-number">87.50 %</td>
|
||||
<td class="with-number">589</td><td class="with-number">67</td><td class="with-number">264</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="beowulf/interop.clj.html">beowulf.interop</a></td><td class="with-bar"><div class="covered"
|
||||
|
@ -236,9 +236,9 @@
|
|||
</tr>
|
||||
<tr><td>Totals:</td>
|
||||
<td class="with-bar"></td>
|
||||
<td class="with-number">65.64 %</td>
|
||||
<td class="with-number">68.60 %</td>
|
||||
<td class="with-bar"></td>
|
||||
<td class="with-number">75.70 %</td>
|
||||
<td class="with-number">77.76 %</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,17 +1,19 @@
|
|||
<!DOCTYPE html PUBLIC ""
|
||||
"">
|
||||
<html><head><meta charset="UTF-8" /><title>Further Reading</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><link rel="icon" type="image/x-icon" href="../img/beowulf_logo_favicon.png" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Beowulf</span> <span class="project-version">0.3.1-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="further_reading.html"><div class="inner"><span>Further Reading</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>beowulf</span></div></a></li><li class="depth-1 "><a href="mexpr.html"><div class="inner"><span>Interpreting M-Expressions</span></div></a></li><li class="depth-1 "><a href="values.html"><div class="inner"><span>The properties of the system, and their values</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>beowulf</span></div></div></li><li class="depth-2 branch"><a href="beowulf.bootstrap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bootstrap</span></div></a></li><li class="depth-2 branch"><a href="beowulf.cons-cell.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cons-cell</span></div></a></li><li class="depth-2 branch"><a href="beowulf.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="beowulf.gendoc.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gendoc</span></div></a></li><li class="depth-2 branch"><a href="beowulf.host.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>host</span></div></a></li><li class="depth-2 branch"><a href="beowulf.interop.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>interop</span></div></a></li><li class="depth-2 branch"><a href="beowulf.io.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></a></li><li class="depth-2 branch"><a href="beowulf.manual.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>manual</span></div></a></li><li class="depth-2 branch"><a href="beowulf.oblist.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oblist</span></div></a></li><li class="depth-2 branch"><a href="beowulf.read.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>read</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>reader</span></div></div></li><li class="depth-3 branch"><a href="beowulf.reader.char-reader.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>char-reader</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.generate.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>generate</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.macros.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>macros</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="beowulf.reader.simplify.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>simplify</span></div></a></li><li class="depth-2"><a href="beowulf.scratch.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>scratch</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#further-reading" name="further-reading"></a>Further Reading</h1>
|
||||
<html><head><meta charset="UTF-8" /><title>Further Reading</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><link rel="icon" type="image/x-icon" href="../img/beowulf_logo_favicon.png" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Beowulf</span> <span class="project-version">0.3.1-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="further_reading.html"><div class="inner"><span>Further Reading</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>beowulf</span></div></a></li><li class="depth-1 "><a href="mexpr.html"><div class="inner"><span>Interpreting M-Expressions</span></div></a></li><li class="depth-1 "><a href="values.html"><div class="inner"><span>The properties of the system, and their values</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>beowulf</span></div></div></li><li class="depth-2 branch"><a href="beowulf.bootstrap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bootstrap</span></div></a></li><li class="depth-2 branch"><a href="beowulf.cons-cell.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cons-cell</span></div></a></li><li class="depth-2 branch"><a href="beowulf.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="beowulf.gendoc.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gendoc</span></div></a></li><li class="depth-2 branch"><a href="beowulf.host.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>host</span></div></a></li><li class="depth-2 branch"><a href="beowulf.interop.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>interop</span></div></a></li><li class="depth-2 branch"><a href="beowulf.io.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></a></li><li class="depth-2 branch"><a href="beowulf.manual.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>manual</span></div></a></li><li class="depth-2 branch"><a href="beowulf.oblist.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oblist</span></div></a></li><li class="depth-2 branch"><a href="beowulf.read.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>read</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>reader</span></div></div></li><li class="depth-3 branch"><a href="beowulf.reader.char-reader.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>char-reader</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.generate.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>generate</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.macros.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>macros</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="beowulf.reader.simplify.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>simplify</span></div></a></li><li class="depth-2"><a href="beowulf.scratch.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>scratch</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#further-reading" id="further-reading"></a>Further Reading</h1>
|
||||
<ol>
|
||||
<li><a href="http://bitsavers.org/pdf/mit/computer_center/Coding_for_the_MIT-IBM_704_Computer_Oct57.pdf">CODING for the MIT-IBM 704 COMPUTER, October 1957</a> This paper is not about Lisp. But it is about the particular individual computer on which Lisp was first implemented, and it is written in part by members of the Lisp team. I have found it useful in understanding the software environment in which, and the constraints under which, Lisp was written.</li>
|
||||
<li><a href="https://www.softwarepreservation.org/projects/LISP/MIT/AIM-001.pdf">MIT AI Memo 1, John McCarthy, September 1958</a> This is, as far as I can find, the earliest specification document of the Lisp project.</li>
|
||||
<li><a href="https://bitsavers.org/pdf/mit/rle_lisp/LISP_I_Programmers_Manual_Mar60.pdf">Lisp 1 Programmer’s Manual, Phyllis Fox, March 1960</a></li>
|
||||
<li><a href="https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf#page=81">Lisp 1.5 Programmer’s Manual, Michael I. Levin, August 1962</a> This book is essential reading: it documents in some detail the first fully realised Lisp language system.</li>
|
||||
<li><a href="https://dl.acm.org/doi/pdf/10.1145/800055.802047#page=3">Early LISP History (1956 - 1959), Herbert Stoyan, August 1984</a></li>
|
||||
<li>
|
||||
<p><a href="http://www.paulgraham.com/rootsoflisp.html">The Roots of Lisp, Paul Graham, 2001</a></p></li>
|
||||
<li>
|
||||
<p><a href="http://www.paulgraham.com/icad.html">The Revenge of the Nerds, Paul Graham, 2002</a> This is mainly about why to use Lisp as a language for modern commercial software, but has useful insights into where it comes from.</p>
|
||||
<blockquote>
|
||||
<p>So the short explanation of why this 1950s language is not obsolete is that it was not technology but math, and math doesn’t get stale.</p>
|
||||
</blockquote></li>
|
||||
</ol></div></div></div></body></html>
|
||||
<li><a href="http://bitsavers.org/pdf/mit/computer_center/Coding_for_the_MIT-IBM_704_Computer_Oct57.pdf">CODING for the MIT-IBM 704 COMPUTER, October 1957</a> This paper is not about Lisp. But it is about the particular individual computer on which Lisp was first implemented, and it is written in part by members of the Lisp team. I have found it useful in understanding the software environment in which, and the constraints under which, Lisp was written.</li>
|
||||
<li><a href="https://www.softwarepreservation.org/projects/LISP/MIT/AIM-001.pdf">MIT AI Memo 1, John McCarthy, September 1958</a> This is, as far as I can find, the earliest specification document of the Lisp project.</li>
|
||||
<li><a href="https://bitsavers.org/pdf/mit/rle_lisp/LISP_I_Programmers_Manual_Mar60.pdf">Lisp 1 Programmer’s Manual, Phyllis Fox, March 1960</a></li>
|
||||
<li><a href="https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf#page=81">Lisp 1.5 Programmer’s Manual, Michael I. Levin, August 1962</a> This book is essential reading: it documents in some detail the first fully realised Lisp language system.</li>
|
||||
<li><a href="https://dl.acm.org/doi/pdf/10.1145/800055.802047#page=3">Early LISP History (1956 - 1959), Herbert Stoyan, August 1984</a></li>
|
||||
<li>
|
||||
<p><a href="http://www.paulgraham.com/rootsoflisp.html">The Roots of Lisp, Paul Graham, 2001</a></p>
|
||||
</li>
|
||||
<li><a href="http://www.paulgraham.com/icad.html">The Revenge of the Nerds, Paul Graham, 2002</a> This is mainly about why to use Lisp as a language for modern commercial software, but has useful insights into where it comes from.
|
||||
<blockquote>
|
||||
<p>So the short explanation of why this 1950s language is not obsolete is that it was not technology but math, and math doesn’t get stale.</p>
|
||||
</blockquote>
|
||||
</li>
|
||||
</ol>
|
||||
</div></div></div></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -19,11 +19,12 @@
|
|||
[environ "1.2.0"]
|
||||
[instaparse "1.4.12"]
|
||||
[org.jline/jline "3.23.0"]
|
||||
[rhizome "0.2.9"] ;; not needed in production builds
|
||||
[com.github.seancorfield/expectations "2.0.165"]
|
||||
;; [rhizome "0.2.9"] ;; not needed in production builds
|
||||
]
|
||||
:main beowulf.core
|
||||
:plugins [[lein-cloverage "1.2.2"]
|
||||
[lein-codox "0.10.7"]
|
||||
[lein-codox "0.10.8"]
|
||||
[lein-environ "1.1.0"]]
|
||||
:profiles {:jar {:aot :all}
|
||||
:uberjar {:aot :all}
|
||||
|
|
|
@ -441,7 +441,7 @@
|
|||
recurse down the list two entries at a time to avoid confusing names
|
||||
with values."
|
||||
[target plist]
|
||||
(if (and (instance? ConsCell plist)(even? (count plist)))
|
||||
(if (and (instance? ConsCell plist) (even? (count plist)))
|
||||
(cond (= plist NIL) NIL
|
||||
(= (first plist) target) plist
|
||||
:else (hit-or-miss-assoc target (CDDR plist)))
|
||||
|
@ -516,9 +516,10 @@
|
|||
`indicator` of the symbol which is the first element of the pair to the
|
||||
value which is the second element of the pair. See page 58 of the manual."
|
||||
[a-list indicator]
|
||||
(map
|
||||
#(PUT (CAR %) indicator (CDR %))
|
||||
a-list))
|
||||
(doall
|
||||
(map
|
||||
#(when (PUT (CAR %) indicator (CDR %)) (CAR %))
|
||||
a-list)))
|
||||
|
||||
(defn DEFINE
|
||||
"Bootstrap-only version of `DEFINE` which, post boostrap, can be overwritten
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
(ns beowulf.host-test
|
||||
(:require [beowulf.cons-cell :refer [F make-beowulf-list T]]
|
||||
[beowulf.host :refer [CDR DIFFERENCE GENSYM GET NUMBERP PLUS PUT
|
||||
RPLACA RPLACD TIMES]]
|
||||
(:require [beowulf.cons-cell :refer [F make-beowulf-list make-cons-cell T]]
|
||||
[beowulf.host :refer [ADD1 AND CADDDR CAR CDR DEFINE DIFFERENCE
|
||||
ERROR FIXP GREATERP lax? LESSP NILP NULL
|
||||
NUMBERP OR PLUS RPLACA RPLACD SUB1 TIMES uaf]]
|
||||
[beowulf.io :refer [SYSIN]]
|
||||
[beowulf.oblist :refer [NIL]]
|
||||
[beowulf.oblist :refer [*options* NIL]]
|
||||
[beowulf.read :refer [gsp]]
|
||||
[clojure.test :refer [deftest is testing use-fixtures]]))
|
||||
[clojure.test :refer [deftest is testing use-fixtures]]
|
||||
[expectations.clojure.test
|
||||
:refer [defexpect expect more-> more-of]]))
|
||||
|
||||
(use-fixtures :once (fn [f]
|
||||
(try (when (SYSIN "resources/lisp1.5.lsp")
|
||||
|
@ -20,31 +23,44 @@
|
|||
(deftest destructive-change-test
|
||||
(testing "RPLACA"
|
||||
(let
|
||||
[l (make-beowulf-list '(A B C D E))
|
||||
target (CDR l)
|
||||
expected "(A F C D E)"
|
||||
actual (do (RPLACA target 'F) (print-str l))]
|
||||
[l (make-beowulf-list '(A B C D E))
|
||||
target (CDR l)
|
||||
expected "(A F C D E)"
|
||||
actual (do (RPLACA target 'F) (print-str l))]
|
||||
(is (= actual expected)))
|
||||
(is (thrown-with-msg?
|
||||
Exception
|
||||
#"Un-ġefōg þing in RPLACA.*"
|
||||
(RPLACA (make-beowulf-list '(A B C D E)) "F"))
|
||||
Exception
|
||||
#"Un-ġefōg þing in RPLACA.*"
|
||||
(RPLACA (make-beowulf-list '(A B C D E)) "F"))
|
||||
"You can't represent a string in Lisp 1.5")
|
||||
(is (thrown-with-msg?
|
||||
Exception
|
||||
#"Uncynlic miercels in RPLACA.*"
|
||||
(RPLACA '(A B C D E) 'F))
|
||||
"You can't RPLACA into anything which isn't a MutableSequence.")
|
||||
)
|
||||
(testing "RPLACA"
|
||||
Exception
|
||||
#"Uncynlic miercels in RPLACA.*"
|
||||
(RPLACA '(A B C D E) 'F))
|
||||
"You can't RPLACA into anything which isn't a MutableSequence."))
|
||||
(testing "RPLACD"
|
||||
(let
|
||||
[l (make-beowulf-list '(A B C D E))
|
||||
target (CDR l)
|
||||
expected "(A B . F)"
|
||||
actual (do (RPLACD target 'F) (print-str l))]
|
||||
[l (make-beowulf-list '(A B C D E))
|
||||
target (CDR l)
|
||||
expected "(A B . F)"
|
||||
actual (do (RPLACD target 'F) (print-str l))]
|
||||
(is (= actual expected)))
|
||||
)
|
||||
)
|
||||
(let
|
||||
[l (make-beowulf-list '(A B C D E))
|
||||
target (CDR l)
|
||||
expected "(A B)"
|
||||
actual (do (RPLACD target NIL) (print-str l))]
|
||||
(is (= actual expected)))
|
||||
(is (thrown-with-msg?
|
||||
Exception
|
||||
#"Un-ġefōg þing in RPLACD.*"
|
||||
(RPLACD (make-beowulf-list '(A B C D E)) :a))
|
||||
"You can't represent a keyword in Lisp 1.5")
|
||||
(is (thrown-with-msg?
|
||||
Exception
|
||||
#"Uncynlic miercels in RPLACD.*"
|
||||
(RPLACD "ABCDE" 'F))
|
||||
"You can't RPLACD into anything which isn't a MutableSequence.")))
|
||||
|
||||
(deftest numberp-tests
|
||||
(testing "NUMBERP"
|
||||
|
@ -71,13 +87,171 @@
|
|||
(let [expected 3.5
|
||||
actual (PLUS 1.25 9/4)]
|
||||
(is (= actual expected))
|
||||
(is (float? actual)))
|
||||
(let [expected 3.5
|
||||
actual (PLUS -2.5 6)]
|
||||
(is (= actual expected) "Negative numbers are cool.")
|
||||
(is (float? actual))))
|
||||
(testing "TIMES"
|
||||
(let [expected 6
|
||||
actual (TIMES 2 3)]
|
||||
(is (= actual expected)))
|
||||
(let [expected 2.5
|
||||
actual (TIMES 5 0.5)]
|
||||
(is (= actual expected))))
|
||||
(testing "DIFFERENCE"
|
||||
(let [expected -1
|
||||
actual (DIFFERENCE 1 2)]
|
||||
(is (= actual expected)))
|
||||
(let [expected (float 0.1)
|
||||
actual (DIFFERENCE -0.1 -0.2)]
|
||||
(is (= actual expected))))
|
||||
(testing "ADD1"
|
||||
(let [expected -1
|
||||
actual (ADD1 -2)]
|
||||
(is (= actual expected)))
|
||||
(let [expected (float 3.5)
|
||||
actual (ADD1 2.5)]
|
||||
(is (= actual expected))))
|
||||
(testing "SUB1"
|
||||
(let [expected -3
|
||||
actual (SUB1 -2)]
|
||||
(is (= actual expected)))
|
||||
(let [expected (float 1.5)
|
||||
actual (SUB1 2.5)]
|
||||
(is (= actual expected)))))
|
||||
|
||||
(deftest laxness
|
||||
(testing "lax"
|
||||
(let [expected true
|
||||
actual (lax? 'Test)]
|
||||
(is (= actual expected) "Pass, the Queen's Cat, and all's well")))
|
||||
(testing "strict"
|
||||
(binding [*options* (assoc *options* :strict true)]
|
||||
(is (thrown-with-msg? Exception #".*ne āfand innan Lisp 1.5" (lax? 'Test))))))
|
||||
|
||||
(deftest access-tests
|
||||
(testing "primitive access"
|
||||
(let [cell (make-cons-cell 1 7)]
|
||||
(let [expected 1
|
||||
actual (CAR cell)]
|
||||
(is (= actual expected)))
|
||||
(let [expected 7
|
||||
actual (CDR cell)]
|
||||
(is (= actual expected))))
|
||||
(is (thrown-with-msg? Exception #".*Ne can tace CAR of.*" (CAR 7)))
|
||||
(is (thrown-with-msg? Exception #".*Ne can tace CDR of.*" (CDR 'A)))
|
||||
(is (thrown-with-msg? Exception #".*Ne liste.*" (CADDDR "Foo")))
|
||||
(is (thrown-with-msg? Exception #".*uaf: unexpected letter in path.*"
|
||||
(uaf (make-beowulf-list '(A B C D))
|
||||
'(\d \a \z \e \d))))))
|
||||
|
||||
(deftest misc-predicate-tests
|
||||
(testing "NULL"
|
||||
(let [expected T
|
||||
actual (NULL NIL)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (NULL (make-beowulf-list '(A B C)))]
|
||||
(is (= actual expected))))
|
||||
(testing "NILP"
|
||||
(let [expected T
|
||||
actual (NILP NIL)]
|
||||
(is (= actual expected)))
|
||||
(let [expected NIL
|
||||
actual (NILP (make-beowulf-list '(A B C)))]
|
||||
(is (= actual expected))))
|
||||
(testing "AND"
|
||||
(let [expected T
|
||||
actual (AND)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (AND T T)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (AND T T T)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (AND 1 'A (make-beowulf-list '(A B C)))]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (AND NIL)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (AND T T F T)]
|
||||
(is (= actual expected))))
|
||||
(testing "OR"
|
||||
(let [expected F
|
||||
actual (OR)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (OR NIL T)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (OR T F T)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (OR 1 F (make-beowulf-list '(A B C)))]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (OR NIL)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (OR NIL F)]
|
||||
(is (= actual expected))))
|
||||
(testing "FIXP"
|
||||
(let [expected F
|
||||
actual (FIXP NIL)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (FIXP 'A)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (FIXP 3.2)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (FIXP 7)]
|
||||
(is (= actual expected))))
|
||||
(testing "LESSP"
|
||||
(let [expected F
|
||||
actual (LESSP 7 3)]
|
||||
(is (= actual expected)))
|
||||
(let [expected T
|
||||
actual (LESSP -7 3.5)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (LESSP 3.14 3.14)]
|
||||
(is (= actual expected))))
|
||||
(testing "GREATERP"
|
||||
(let [expected T
|
||||
actual (GREATERP 7 3)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (GREATERP -7 3.5)]
|
||||
(is (= actual expected)))
|
||||
(let [expected F
|
||||
actual (GREATERP 3.14 3.14)]
|
||||
(is (= actual expected)))))
|
||||
|
||||
;; Really tricky to get DEFINE set up for testing here. It works OK in the
|
||||
;; REPL, but there's nonsense going on with lazy sequences. Better to
|
||||
;; reimplement in Lisp.
|
||||
;; (deftest define-tests
|
||||
;; (testing "DEFINE"
|
||||
;; (let [expected "(FF)"
|
||||
;; actual (str (doall (DEFINE
|
||||
;; (gsp "((FF LAMBDA (X) (COND ((ATOM X) X) (T (FF (CAR X))))))"))))]
|
||||
;; (is (= actual expected)))))
|
||||
|
||||
(defexpect error-without-code
|
||||
(expect (more-> clojure.lang.ExceptionInfo type
|
||||
(more-of {:keys [:phase :function :args :type :code]}
|
||||
'A1 code) ex-data)
|
||||
(ERROR)))
|
||||
|
||||
(defexpect error-with-code
|
||||
(let [x 'X1]
|
||||
(expect (more-> clojure.lang.ExceptionInfo type
|
||||
(more-of {:keys [:phase :function :args :type :code]}
|
||||
x code) ex-data)
|
||||
(ERROR x))))
|
||||
|
|
Loading…
Reference in a new issue