-
Notifications
You must be signed in to change notification settings - Fork 17
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
Some helper functions #150
Comments
Hi @pevnak
What I am happy to include is some helper like this: using Accessors
import Accessors: ComposedOptic
decompose(optic) = (optic,)
decompose(optic::ComposedOptic) = (decompose(optic.outer)..., decompose(optic.inner)...) A PR to Accessors.jl would be welcome! You could then do the indexing like |
Actually I think the decompose function can even go to CompositionsBase.jl. |
I like the To which part you refer as not being type stable? The normalization was mean to ensure that the outer part of I can create these PRs with Tests to Accessors.jl.
|
|
This is crystal clear answer. I will work on relevant PRs. |
Dear All,
I am using setfield for indexing in terribly complicated tree structures naturally present in tree data. Since I frequently need programmatically adapt lenses, it helps a lot, if they are in normalized form. I have therefore made a few functions, which simplifies my life a lot and I wonder, if that would be something you would consider interesting.
The first function "normalizes" lenses, such that outerlens in CompoundLens is simple.
And when I have the
lenskeys
, I can easily implement indexing asI would like to know your opinion and if they would fit to the library. If so, I would prepare a full PR.
Thanks a lot,
Tomas
The text was updated successfully, but these errors were encountered: