Quark.Pointfree (Quark v2.3.2) View Source

Allows defining functions as straight function composition (ie: no need to state the argument).

Provides a clean, composable named functions

Link to this section Summary

Functions

Define a unary function with an implied subject

Define a private unary function with an implied subject

Link to this section Functions

Link to this macro

defx(head, list)

View Source (macro)

Define a unary function with an implied subject

Examples

iex> defmodule Foo do
...>   import Quark.Pointfree
...>   defx foo(), do: Enum.sum |> fn x -> x + 1 end.()
...> end
...> Foo.foo([1,2,3])
7

iex> defmodule Bar do
...>   import Quark.Pointfree
...>   defx bar, do: Enum.sum |> fn x -> x + 1 end.()
...> end
...> Bar.bar([1,2,3])
7
Link to this macro

defxp(head, list)

View Source (macro)

Define a private unary function with an implied subject

Examples

defmodule Foo do
  import Quark.Pointfree
  defxp foo(), do: Enum.sum |> fn x -> x + 1 end.()
end