diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-02-21 03:21:43 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-02-21 19:42:32 +0100 |
commit | b12c86ccd5b15e1c8c161db911375b6e4c419c0f (patch) | |
tree | 5ab1d007ebc0dc267fca6b2c67125a5c84397c11 | |
parent | Fix seeding of UUIDs. (diff) | |
download | calp-b12c86ccd5b15e1c8c161db911375b6e4c419c0f.tar.gz calp-b12c86ccd5b15e1c8c161db911375b6e4c419c0f.tar.xz |
Change kvlist->assq to return pairs.
Diffstat (limited to '')
-rw-r--r-- | doc/ref/guile/util.texi | 4 | ||||
-rw-r--r-- | module/hnh/util.scm | 3 | ||||
-rw-r--r-- | tests/test/util.scm | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/doc/ref/guile/util.texi b/doc/ref/guile/util.texi index 72463407..1b4228cd 100644 --- a/doc/ref/guile/util.texi +++ b/doc/ref/guile/util.texi @@ -175,8 +175,8 @@ pairs of symbols and values. @lisp (kvlist->assq '(#:a 1 #:b "Hello")) -⇒ ((a 1) - (b "Hello")) +⇒ ((a . 1) + (b . "Hello")) @end lisp @end defun diff --git a/module/hnh/util.scm b/module/hnh/util.scm index 929f23a0..ffac17bd 100644 --- a/module/hnh/util.scm +++ b/module/hnh/util.scm @@ -313,7 +313,8 @@ (define (kvlist->assq kvlist) (map (lambda (pair) - (cons (keyword->symbol (car pair)) (cdr pair))) + (cons (keyword->symbol (car pair)) + (cadr pair))) (group kvlist 2))) (define* (assq-limit alist optional: (number 1)) diff --git a/tests/test/util.scm b/tests/test/util.scm index ab50898a..c91017fc 100644 --- a/tests/test/util.scm +++ b/tests/test/util.scm @@ -112,12 +112,12 @@ (assq-merge '((k 1) (v 2)) '((k 2)))) (test-equal "kvlist->assq" - '((a 1) (b 2)) + '((a . 1) (b . 2)) (kvlist->assq '(a: 1 b: 2))) (test-equal "kvlist->assq repeated key" - '((a 1) (b 2) (a 3)) + '((a . 1) (b . 2) (a . 3)) (kvlist->assq '(a: 1 b: 2 a: 3))) ;; TODO assq-limit ? |