Skip to content

Commit

Permalink
Minor tweaks, mostly for build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott L. Burson committed Dec 5, 2024
1 parent 8873c56 commit 0537902
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
28 changes: 0 additions & 28 deletions Code/relations.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -539,34 +539,6 @@ Note that `filterp', if supplied, must take two arguments."
(WB-Map-Tree-Compare (wb-2-relation-map0 a) (wb-2-relation-map0 b)
#'WB-Set-Tree-Compare)))))

(defmethod verify ((br wb-2-relation))
;; Slow, but thorough.
(and (WB-Map-Tree-Verify (wb-2-relation-map0 br))
(WB-Map-Tree-Verify (wb-2-relation-map1 br))
(let ((size 0))
(and (Do-WB-Map-Tree-Pairs (x s (wb-2-relation-map0 br) t)
(WB-Set-Tree-Verify s)
(incf size (WB-Set-Tree-Size s))
(or (null (wb-2-relation-map1 br))
(Do-WB-Set-Tree-Members (y s)
(let ((ignore s1 (WB-Map-Tree-Lookup (wb-2-relation-map1 br) y)))
(declare (ignore ignore))
(unless (WB-Set-Tree-Member? s1 x)
(format *debug-io* "Map discrepancy in wb-2-relation")
(return nil))))))
(or (= size (wb-2-relation-size br))
(progn (format *debug-io* "Size discrepancy in wb-2-relation")
nil))))
(or (null (wb-2-relation-map1 br))
(let ((size 0))
(Do-WB-Map-Tree-Pairs (x s (wb-2-relation-map1 br))
(declare (ignore x))
(WB-Set-Tree-Verify s)
(incf size (WB-Set-Tree-Size s)))
(or (= size (wb-2-relation-size br))
(progn (format *debug-io* "Size discrepancy in wb-2-relation")
nil))))))


(defgeneric transitive-closure (2-relation set)
(:documentation
Expand Down
28 changes: 28 additions & 0 deletions Code/testing.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3555,6 +3555,34 @@
(defmethod verify ((s wb-seq))
(WB-Seq-Tree-Verify (wb-seq-contents s)))

(defmethod verify ((br wb-2-relation))
;; Slow, but thorough.
(and (WB-Map-Tree-Verify (wb-2-relation-map0 br))
(WB-Map-Tree-Verify (wb-2-relation-map1 br))
(let ((size 0))
(and (Do-WB-Map-Tree-Pairs (x s (wb-2-relation-map0 br) t)
(WB-Set-Tree-Verify s)
(incf size (WB-Set-Tree-Size s))
(or (null (wb-2-relation-map1 br))
(Do-WB-Set-Tree-Members (y s)
(let ((ignore s1 (WB-Map-Tree-Lookup (wb-2-relation-map1 br) y)))
(declare (ignore ignore))
(unless (WB-Set-Tree-Member? s1 x)
(format *debug-io* "Map discrepancy in wb-2-relation")
(return nil))))))
(or (= size (wb-2-relation-size br))
(progn (format *debug-io* "Size discrepancy in wb-2-relation")
nil))))
(or (null (wb-2-relation-map1 br))
(let ((size 0))
(Do-WB-Map-Tree-Pairs (x s (wb-2-relation-map1 br))
(declare (ignore x))
(WB-Set-Tree-Verify s)
(incf size (WB-Set-Tree-Size s)))
(or (= size (wb-2-relation-size br))
(progn (format *debug-io* "Size discrepancy in wb-2-relation")
nil))))))


(defun eqv (a b &rest more)
(and (or (eq a b) (and a b))
Expand Down
4 changes: 4 additions & 0 deletions Code/tuples.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ of calling `val-fn' on the value from `tuple1' and the value from `tuple2'.
(declare (ignore environment))
`(convert 'dyn-tuple ',(convert 'list tup)))

(defmethod make-load-form ((key tuple-key) &optional environment)
(declare (ignore environment))
`(get-tuple-key ',(tuple-key-name key) ',(tuple-key-default-fn key)))


;;; ================================================================================

Expand Down
10 changes: 5 additions & 5 deletions Code/wb-trees.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4000,11 +4000,11 @@ or else `default', and (b) `second-arg'."
((:equal :unequal)
;; Since we're probably updating the value anyway, we don't bother trying
;; to figure out whether we can reuse the node.
(let ((new-key new-val (Equivalent-Map-Update node-key (WB-Map-Tree-Node-Value tree)
key value-fn default second-arg)))
(Make-WB-Map-Tree-Node new-key new-val
(WB-Map-Tree-Node-Left tree)
(WB-Map-Tree-Node-Right tree))))
(let ((new-key new-val (Equivalent-Map-Update node-key (WB-Map-Tree-Node-Value tree)
key value-fn default second-arg)))
(Make-WB-Map-Tree-Node new-key new-val
(WB-Map-Tree-Node-Left tree)
(WB-Map-Tree-Node-Right tree))))
((:less)
(WB-Map-Tree-Build-Node (WB-Map-Tree-Node-Key tree)
(WB-Map-Tree-Node-Value tree)
Expand Down

0 comments on commit 0537902

Please sign in to comment.