-
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
Invalid behaviour of Pathex.delete!
when using concatenation and/or all
lense
#20
Comments
Yeah, looks like a bug in concatenation of |
Yeah, there was a tiny typo in But you're kinda misusing the library. delete(list, all() ~> path("a")) returns To work with a more lazy-style evalutation I'd suggest using |
@ffloyd , you can use version |
Thank you! I am impressed with how fast you reacted! Appreciate it! I checked the behavior for the updated version. With the import Pathex
data = [
%{ "a" => 1 },
%{ "a" => 2 }
]
all_a = Pathex.Lenses.all() ~> path("a")
Pathex.get(data, all_a) |> IO.inspect(label: "get")
Pathex.delete!(data, all_a) |> IO.inspect(label: "delete!") And as result
|
Let's say I have the following data:
and my goal is to delete all
"a"
keys from all maps in the inner list. So, I create a path for them:But when I use
delete!
it just wipes all items in the list:Then I tried to not use the lens, but still do concatenation:
When I use path without concatenation it works as it should:
Then I tried to check what will happen with some deeeep data:
So, it looks like
delete!/2
has some real problems with lenses and concatenation. =)The text was updated successfully, but these errors were encountered: