Update ldict-keys.

This commit is contained in:
Dominik Pantůček 2023-04-09 19:47:17 +02:00
parent ac1c5d28c6
commit 5533a3256e
2 changed files with 9 additions and 2 deletions

View file

@ -90,6 +90,12 @@ the dictionary does not contain the key ```k```, an error is raised.
Sets existing key ```k``` to the new value ```v``` or inserts it if it
is not already present in the dictionary ```ld```.
(ldict-keys ld)
* ```ld``` - a ldict instance
Returns the list of keys stored in given dictionary.
### IO
(import util-io)

View file

@ -39,6 +39,7 @@
ldict-remove
ldict-set
ldict-keys
ldict-map
ldict-filter
@ -144,8 +145,8 @@
(cons (car pairs) res)))))))
;; Returns the list of keys stored in given dictionary.
(define (dict-keys d)
(map car d))
(define (ldict-keys ld)
(map car (ldict-pairs ld)))
;; Maps dictionary values, the procedure gets key-value pairs if it
;; accepts more than one argument. If it accepts a third argument,