Reimplement and document ldict-reduce.
This commit is contained in:
parent
90fa195dc5
commit
6a35b94f34
2 changed files with 16 additions and 5 deletions
|
@ -193,13 +193,13 @@
|
|||
|
||||
;; Reduce over dictinary, the reducing procedure gets accumulator,
|
||||
;; key and value as its three arguments.
|
||||
(define (dict-reduce init proc d)
|
||||
(let loop ((d d)
|
||||
(define (ldict-reduce init proc ld)
|
||||
(let loop ((pairs (ldict-pairs ld))
|
||||
(acc init))
|
||||
(if (null? d)
|
||||
(if (null? pairs)
|
||||
acc
|
||||
(loop (cdr d)
|
||||
(proc acc (caar d) (cdar d))))))
|
||||
(loop (cdr pairs)
|
||||
(proc acc (caar pairs) (cdar pairs))))))
|
||||
|
||||
;; Functional update
|
||||
(define (dict-update d k proc . dfls)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue