Git Product home page Git Product logo

Comments (5)

aantron avatar aantron commented on June 12, 2024

I suppose we could translate

| (`P1 | `P2), (`P3 | `P4) -> e

to

| `P1, `P3 -> point 1; point 3; e' ()
| `P1, `P4 -> point 1; point 4; e' ()
| `P2, `P3 -> point 2; point 3; e' ()
| `P2, `P4 -> point 2; point 4; e' ()

i.e. count visits to the clauses independently instead of trying to count visits to elements of their cross product.

In any case, this kind of translation would help me to test automata in Markup.ml much more thoroughly.

from bisect_ppx.

rleonid avatar rleonid commented on June 12, 2024

I'm a bit confused, your original example doesn't compile; the first branch is a variant and the second a tuple. Did you mean:

match foo with
| `P1 -> e1
| (`P2 | `P3 as x) as y -> e2

from bisect_ppx.

aantron avatar aantron commented on June 12, 2024

Yes :) I changed the patterns from p1 to ``P1` at the last moment and wasn't careful updating it.

from bisect_ppx.

rleonid avatar rleonid commented on June 12, 2024

I think a simpler way of rewriting the original example would be:

match foo with
| `P1 -> Bisect.mark 0; e1
| (`P2 | `P3 as x) -> (match x with `P2 -> Bisect.mark 1 | `P3 -> Bisect.mark 2); e2

This has the advantage of being a simpler recursive map of the Ppat_or pattern

from bisect_ppx.

aantron avatar aantron commented on June 12, 2024

I think the recursive map is ultimately the same, just the interpretation (what is being constructed as a result of it) is different, but this is a good idea. It doesn't change the "real" case list entered by the user, which keeps instrumented code resistant to bugs in Bisect_ppx, among other things. Thanks.

from bisect_ppx.

Related Issues (20)

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.