Skip to content
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

struct->vector isomorphism #254

Open
jackfirth opened this issue Dec 4, 2015 · 5 comments
Open

struct->vector isomorphism #254

jackfirth opened this issue Dec 4, 2015 · 5 comments
Labels
Milestone

Comments

@jackfirth
Copy link
Owner

Given a structure id, it should be possible to construct an isomoprhism between struct instances of that type and vectors

> (struct position (x y))
> (lens-view (struct->vector-lens position) (position 1 2))
'#(1 2)
@jackfirth jackfirth added this to the 3.0 milestone Dec 4, 2015
@AlexKnauth
Copy link
Collaborator

I think using the name struct->vector-lens would be confusing because struct->vector puts the extra struct:position symbol at the beginning. struct->list-lens would work for this though, because struct->list doesn't include that symbol.

@jackfirth
Copy link
Owner Author

I forgot about struct->vector, the lens form should match whatever that does. A struct->list lens would have to be careful of the fact that struct->list is only available in racket 6.3, I'd like to keep supporting the versions we do now.

@AlexKnauth
Copy link
Collaborator

We could support struct->list-lens without relying on 6.3 if we looked at the struct-info and used the normal accessors, which we should probably be doing anyway.

@jackfirth
Copy link
Owner Author

Agreed, that would probably be the best way to do this.

@AlexKnauth
Copy link
Collaborator

Should this issue be closed because of #266 ?

@jackfirth jackfirth removed the ready label Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants