Comments (5)
Yeah, there was a tiny typo in concat.ex
But you're kinda misusing the library. all()
lens works in an eager-style evaluation. Therefore. this lens either deletes all the values, or returns an error. For example,
delete(list, all() ~> path("a"))
returns{:ok, []}
if all elements of the list
have "a"
as a key or :error
.
To work with a more lazy-style evalutation I'd suggest using star()
lens. And I think, your deep_dive_path
should be implemented using star
lens.
from pathex.
@ffloyd , you can use version 2.4.1
from pathex.
Thank you! I am impressed with how fast you reacted! Appreciate it!
I checked the behavior for the updated version. With the star/0
lens everything works as expected. But I still see some weird behavior with all/0
lens:
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 get/2
works, but delete/2
fails:
** (Pathex.Error)
Couldn't find element
Path: all() ~> path("a")
Structure: [%{"a" => 1}, %{"a" => 2}]
(stdlib 3.17.2) erl_eval.erl:685: :erl_eval.do_apply/6
(stdlib 3.17.2) erl_eval.erl:893: :erl_eval.expr_list/6
(stdlib 3.17.2) erl_eval.erl:408: :erl_eval.expr/5
(elixir 1.14.0) lib/module/parallel_checker.ex:100: Module.ParallelChecker.verify/1
from pathex.
Yeah, looks like a bug in concatenation of delete
operation
from pathex.
@ffloyd , opened #21 to track the issue
from pathex.
Related Issues (12)
- Error when using tuple with variable in path creation
- Pathex does not compile with elixir 1.14.0-rc0 HOT 2
- feature request: Delete op that succeeds even if path isn't found HOT 4
- All lens deletion bug HOT 1
- Dialyzer complains about deletion functions HOT 5
- exists?/2 bug
- Single-line import of core, lenses, and combinator HOT 3
- Is it possible to define collection type when using from_list? HOT 2
- path(y :: :list, :json)
- Delete a key? HOT 4
- How should I create a path from a list? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pathex.