Code Monkey home page Code Monkey logo

exmatch's People

Contributors

rumataestor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

exmatch's Issues

Support match block

    exmatch %OrderMatcherManager{
             capacities: capacities,
             matchers: %{
               {"BTC", "USDC", :buy} =>
                 OrderMatcherManager.registering(clients: [{^async_pid, _}])
             },
             delayed_matchers: delayed_matchers,
             notify_capacity_timer: timer_ref,
             notify_capacity_state: :min_scheduled
           } = get_state_when_registering_order_matcher({"BTC", "USDC", :buy})

** (RuntimeError) Special form __block__/2 is not yet supported in ExMatch
Please submit a report to handle {:__block__, [], [{:=, [], [{:clients, [counter: {LimitOrder.OrderMatcherManagerTest, 100}], LimitOrder.OrderMatcherManagerTest}, [{{:^, [line: 157], [{:async_pid, [line: 157], nil}]}, {:_, [line: 157], nil}}]]}, {:{}, [], [:registering, nil, nil, {:clients, [counter: {LimitOrder.OrderMatcherManagerTest, 100}], LimitOrder.OrderMatcherManagerTest}]}]}
    (exmatch 0.16.0) lib/exmatch/expr.ex:33: ExMatch.Expr.parse/2
    (exmatch 0.16.0) lib/exmatch/expr.ex:43: ExMatch.Expr.expand/2
    (exmatch 0.16.0) lib/exmatch/expr.ex:20: ExMatch.Expr.parse/2
    (exmatch 0.16.0) lib/exmatch/map.ex:38: ExMatch.Map.parse_field/5
    (elixir 1.14.1) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (exmatch 0.16.0) lib/exmatch/map.ex:25: ExMatch.Map.parse_fields/2
    (exmatch 0.16.0) lib/exmatch/map.ex:10: ExMatch.Map.parse/2
    (exmatch 0.16.0) lib/exmatch/map.ex:38: ExMatch.Map.parse_field/5
    (elixir 1.14.1) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (exmatch 0.16.0) lib/exmatch/map.ex:25: ExMatch.Map.parse_fields/2
    (exmatch 0.16.0) lib/exmatch/struct.ex:61: ExMatch.Struct.parse/2
    (exmatch 0.16.0) lib/exmatch.ex:81: ExMatch.gen_match/4
    (exmatch 0.16.0) expanding macro: ExMatch.match/2

Provide argument values on exceptions in pattern expressions

f = fn -> false end
exmatch {_, f.() + 1} == {1, 2}

Currently this doesn't even work, but if a local function is used instead of the lambda, it results in obtuse ** (ArithmeticError) bad argument in arithmetic expression without any details.
It would be nice if it showed arguments values which caused the failure:

left:  {..., ((f.() = false) + 1 = ArithmeticError{...})}
right: {..., 2}

or in ExUnit.assert

** (ArithmeticError) bad argument in arithmetic expression: false + 1
     code: f.() + 1,
     stacktrace:
       :erlang.+(false, 1)
       ExMatch.match(...)

Support binding along with matching

ExMatch.match(%{a: %{..., b: 1} = a}, %{a: %{b: 1, c: 2}})
assert a == %{b: 1, c: 2}

Currently we get (with structs):

== Compilation error in file test/....exs ==
** (RuntimeError) Special form =/2 is not yet supported in ExMatch
    (exmatch 0.8.0) lib/binding_protocol.ex:80: ExMatch.Expr.parse/1
    (exmatch 0.8.0) lib/binding_protocol.ex:388: ExMatch.Map.parse_field/6
    (elixir 1.12.3) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3
    (exmatch 0.8.0) lib/binding_protocol.ex:375: ExMatch.Map.parse_fields/3
    (exmatch 0.8.0) lib/binding_protocol.ex:538: ExMatch.Struct.parse/3
    (exmatch 0.8.0) lib/exmatch.ex:36: ExMatch.do_match/3
    (exmatch 0.8.0) expanding macro: ExMatch.match/3
...

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.