-
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
add struct->struct-lens #268
base: master
Are you sure you want to change the base?
Conversation
This is meant to be an isomorphism yes? I think allowing field reordering would be good. A contrived use case I can think of off the top of my head is wanting a lens to view a (struct position (x y))
(define inverse-pos-lens (struct->struct-lens position position [x y] [y x]))
(lens-view inverse-pos-lens (position 1 2)) |
What you said in (#267 (comment)) about |
(syntax-e #'s1) (syntax-e #'s2)) | ||
stx)) | ||
#'(local [(define (s1->s2 struct1) | ||
(#%app s2.constructor-id (s1.accessor-id struct1) ...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the #%app
needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but I suspect it's because the constructor-id from the struct-info ends up pointing to an identifier macro or something like that that messes it up in some way. I forget.
see #267