ReverseMatch (reverse_match v0.1.0)

Suport reverse match to help to write more clear code.

Read more.

Link to this section Summary

Functions

transefome value to new_form or do more

Link to this section Functions

Link to this macro

tr(value, list)

(macro)

transefome value to new_form or do more

Example of tr(value, to: form)

tr transform the value to new new_form, we the value of value, and the variables in the new_form binded.

    import ReverseMatch
    tr({a: 1, b: 2}, to: {a: a, b: _})
    a #=> 1

Example of tr(value, to: new_form, do: more)

After binded variables in new_form, do more work use the varaibles. The value is the value of more

import ReverseMatch
Agent.start_link(fn ->10 end))
|> tr(to: {:ok,pid}, do: pid) # now pid flow downside.
|> Agent.get(&(&1))

# pid is a varibale, after the pipeline, we can stil use it.
Agent.stop(pid)