aboutsummaryrefslogtreecommitdiff
path: root/module/util.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-06-01 13:06:33 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-06-01 13:06:33 +0200
commit95e6f8577495e7cb35b3c1d9c7eef8ad2f0e839e (patch)
tree1cbf5b226e21bc82a1d40dcded20b7936dbb2605 /module/util.scm
parentChange for loop from for-each to map. (diff)
downloadcalp-95e6f8577495e7cb35b3c1d9c7eef8ad2f0e839e.tar.gz
calp-95e6f8577495e7cb35b3c1d9c7eef8ad2f0e839e.tar.xz
Document assq-merge.
Diffstat (limited to 'module/util.scm')
-rw-r--r--module/util.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/module/util.scm b/module/util.scm
index 54a57a2c..6d8aeaf7 100644
--- a/module/util.scm
+++ b/module/util.scm
@@ -369,6 +369,14 @@
(resolve-interface '(mod ...)))
...))))
+;; Merges two association lists, comparing with eq.
+;; The cdrs in all pairs in both lists should be lists,
+;; If a key is present in both then the contents of b is
+;; put @emph{before} the contents in a.
+;; @example
+;; (assq-merge '((k 1)) '((k 2)))
+;; => ((k 2 1))
+;; @end example
(define-public (assq-merge a b)
(fold (lambda (entry alist)
(let* (((k . v) entry)