From 95e6f8577495e7cb35b3c1d9c7eef8ad2f0e839e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 1 Jun 2020 13:06:33 +0200 Subject: Document assq-merge. --- module/util.scm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'module/util.scm') 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) -- cgit v1.2.3