Merge pull request #116 from jackfirth/fix-compound-hash-115
Fix compound hash 115
This commit is contained in:
commit
dd7a946086
|
@ -61,12 +61,12 @@
|
|||
(define (get target)
|
||||
(value-list->hash keys (lens-view list-lens target)))
|
||||
(define (set target new-view-hash)
|
||||
(lens-set list-lens target (hash-values new-view-hash)))
|
||||
(lens-set list-lens target (map (hash-ref new-view-hash _) keys)))
|
||||
(make-lens get set))
|
||||
|
||||
(module+ test
|
||||
(define a-b-lens (compound-hash-lens 'a first-lens
|
||||
'b third-lens))
|
||||
(define a-b-lens (compound-hash-lens 'b third-lens
|
||||
'a first-lens))
|
||||
(check-equal? (lens-view a-b-lens '(1 2 3))
|
||||
(hash 'a 1 'b 3))
|
||||
(check-equal? (lens-set a-b-lens '(1 2 3) (hash 'a 100 'b 200))
|
||||
|
|
Loading…
Reference in New Issue
Block a user