diff options
author | Pierre Neidhardt <mail@ambrevar.xyz> | 2022-07-04 21:09:52 +0200 |
---|---|---|
committer | Guillaume Le Vaillant <glv@posteo.net> | 2022-08-03 16:45:54 +0200 |
commit | bcb33357162ccd7423c6355ec48f43e35b90fbf8 (patch) | |
tree | 0c013516e821eee0493b8fa784748a749beddf72 | |
parent | c1b4608ac5247938ccae30ad90ac82d1d23eff43 (diff) | |
download | guix-bcb33357162ccd7423c6355ec48f43e35b90fbf8.tar.gz guix-bcb33357162ccd7423c6355ec48f43e35b90fbf8.zip |
gnu: Add cl-mw-equiv.
* gnu/packages/lisp-xyz.scm (cl-mw-equiv, ecl-mw-equiv, sbcl-mw-equiv): New
variables.
Signed-off-by: Guillaume Le Vaillant <glv@posteo.net>
-rw-r--r-- | gnu/packages/lisp-xyz.scm | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm index 946b68cdf1..3305e36d02 100644 --- a/gnu/packages/lisp-xyz.scm +++ b/gnu/packages/lisp-xyz.scm @@ -10947,6 +10947,58 @@ accompaniment to the standard ANSI facilities.") (define-public ecl-clx-xembed (sbcl-package->ecl-package sbcl-clx-xembed)) +(define-public sbcl-mw-equiv + (let ((commit "3ae871458685b1ef7cd6a996ee22c8c5e738a03d") + (revision "1")) + (package + (name "sbcl-mw-equiv") + (version (git-version "0.1.2" revision commit)) + (home-page "https://github.com/sharplispers/mw-equiv/") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/sharplispers/mw-equiv/") + (commit commit))) + (file-name (git-file-name "cl-mw-equiv" version)) + (sha256 + (base32 "1fl90wp0jp7l90mps53fq0kzb28f10qfr739527h03xwqccyylad")))) + (build-system asdf-build-system/sbcl) + (synopsis "Extensible object equivalence protocol for Common Lisp") + (description "Common Lisp comes with quite some functions to compare +objects for equality, yet none is applicable in every situation and in general +this is hard, as equality of objects depends on the semantics of operations on +them. As consequence, users find themselves regularly in a situation where +they have to roll their own specialized equality test. + +This module provides one of many possible equivalence relations between +standard Common Lisp objects. However, it can be extended for new objects +through a simple CLOS protocol. The rules when two objects are considered +equivalent distinguish between @emph{mutating} and @emph{frozen objects}. A +frozen object is promised not to be mutated in the future in a way that +operations on it can notice the difference. + +We have chosen to compare mutating objects only for identity (pointer +equality), to avoid various problems. Equivalence for frozen objects on the +other hand is established by recursing on the objects' constituent parts and +checking their equivalence. Hence, two objects are equivalent under the +@code{OBJECT=} relation, if they are either identical, or if they are frozen +and structurally equivalent, i.e. their constituents are point-wise +equivalent. + +Since many objects are potentially mutable, but are not necessarily mutated +from a certain point in their life time on, it is possible to promise to the +equivalence relation that they remain frozen for the rest of their life time, +thus enabling coarser equivalence than the often too fine-grained pointer +equality.") + (license license:bsd-2)))) + +(define-public cl-mw-equiv + (sbcl-package->cl-source-package sbcl-mw-equiv)) + +(define-public ecl-mw-equiv + (sbcl-package->ecl-package sbcl-mw-equiv)) + (define-public sbcl-quantile-estimator (package (name "sbcl-quantile-estimator") |