-
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
Rewrite #147
Conversation
Wow! Thanks a lot for giving a shot at this!
Isn't this convention usually for But maybe it'd let us add obj = (a = (b = (c = (1, 2), d = 3,), e = 4,) f = 5)
otherthing = (something = obj, another = nothing)
new_obj = @set(otherthing.something, (40, 50, 20)) do obj
a = obj.a
b = a.b
c = b.c
return (b.e, obj.f, c[2])
end (Or still with the function
I think one more nice thing about it is that we can get the curried version But, if we go with this PR, you can also do Hmm... So Let me know if you have other consideration on the new
This is nice! (So that we can reserve |
Thanks, you brought up a lot of interesting point. I will focus on
Interestingly "getting the flow nice" was also for me the main reason to switch to
Do you see any advantages of |
Thanks for explaining the reasoning behind obj′ = set(obj, lens, val)
@assert obj′ >>′ lens == val where obj′ = set(val, lens, obj)
@assert val == lens <<′ obj′ where From this perspective,
That is to say, I guess another way to put it is that (1) |
Ok, thanks now I get it. I agree data flow compatibility is a nice property. I think with proper |
See #146 List of changes:
Lens
type, lenses are fully duck typed nowget(obj, lens)
bylens(obj)
set(obj, lens, val)
byset(lens, obj, val)
modify(f, obj, lens)
bymodify(f, lens, obj)
lens1 ∘ lens2
bylens2 ∘ lens1
@set!
by@reset
@tkf what you think about it. Especially replacing
set(obj, lens, val)
byset(lens, obj, val)
. In the function lens picture, this feels more natural. Also, it makes a possible future multi objectmodify(f, lens, obj, objs...)
easier.Tests pass locally, except for doctests. Docs are telling lies I plan to fix these when we know what API changes we actually want.
I agree this change is a good opportunity to change the package name.