diff --git a/Code/relations.lisp b/Code/relations.lisp index e48ff5f..5a1ace3 100644 --- a/Code/relations.lisp +++ b/Code/relations.lisp @@ -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 diff --git a/Code/testing.lisp b/Code/testing.lisp index db0aa9e..eaa7d70 100644 --- a/Code/testing.lisp +++ b/Code/testing.lisp @@ -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)) diff --git a/Code/tuples.lisp b/Code/tuples.lisp index 7fc2058..de4dbba 100644 --- a/Code/tuples.lisp +++ b/Code/tuples.lisp @@ -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))) + ;;; ================================================================================ diff --git a/Code/wb-trees.lisp b/Code/wb-trees.lisp index 08264b2..8303a92 100644 --- a/Code/wb-trees.lisp +++ b/Code/wb-trees.lisp @@ -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)