GithubHelp home page GithubHelp logo

Comments (5)

hissssst avatar hissssst commented on May 21, 2024 2

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.

hissssst avatar hissssst commented on May 21, 2024 1

@ffloyd , you can use version 2.4.1

from pathex.

ffloyd avatar ffloyd commented on May 21, 2024 1

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.

hissssst avatar hissssst commented on May 21, 2024

Yeah, looks like a bug in concatenation of delete operation

from pathex.

hissssst avatar hissssst commented on May 21, 2024

@ffloyd , opened #21 to track the issue

from pathex.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.