rex v0.1.0-alpha2 Rex

Summary

Macros

Define a new Rex function

Compile a Rex expression into an Elixir function

Pipe an exising stack to a new Rex expression

Macros

drex(arg)

Define a new Rex function.

You can call drex in two ways, the first is to define a new word that operates on the stack, here for example double is a partial application multiplying by two:

drex double         2 ~> Kernel.*/2

The second way is to define a word for stack shuffling, ie, for example Rex.Stack.swap/1 is defined like:

drex swap(a, b)     (b, a)
rex(expr)

Compile a Rex expression into an Elixir function.

The returned anonymous function can be given a stack to operate on.

rex(stack, expr)

Pipe an exising stack to a new Rex expression.

[5, 2, 3] |> rex(double ~> swap ~> double) #=> [4, 10, 3]