-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set-mapper-lens #200
Comments
I'm running into problems with this and ordering. (define (set-mapper-lens lens)
(make-lens
(λ (tgt)
(list->set (set-map tgt (lens-view lens _))))
(λ (tgt nvw)
(list->set (map (lens-set lens _ _) (set->list tgt) (set->list nvw)))))) Then a test case like this (which worked for lists) fails because of ordering in the lens-set case: (check-equal? (lens-set (set-mapper-lens first-lens) (set '(a b) '(c d) '(e f)) (set 1 2 3))
(set '("a" b) '("c" d) '("e" f))) This fails with this failure message:
|
Oh wait I accidentally put |
If I wanted to do a test case like that I would want: (check-equal? (lens-set (set-mapper-lens first-lens) (set '(a b) '(c d) '(e f)) (set "a" "c" "e"))
(set '("a" b) '("c" d) '("e" f))) But that actually works too. Weird. |
I've thought about this one too and I'm really not sure, because you can't swap out a set of views with a new set of views without knowing which view to swap out for which. I think it'd be more useful to have hash->assoc isomorphims that take an ordering procedure and figure out how to apply those to these sorts of problems. |
Should this try to be consistent with
set-map
(going from sets to lists), or should it go from sets to sets?To follow the lens laws sets to sets would make more sense, and for things like making a
hash-rekey-lens
using ahash->set-lens
isomorphism (see #199 (comment)), but what do you think?The text was updated successfully, but these errors were encountered: