Quark v2.2.0 Quark.Pointfree

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

Provides a clean, composable named functions

Summary

Macros

Define a unary function with an implied subject

Define a private unary function with an implied subject

Macros

defx(head, list)

Define a unary function with an implied subject

Examples

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

iex> defmodule Bar do
...>   use Quark.Pointfree
...>   defx bar, do: Enum.sum |> fn x -> x + 1 end.()
...> end
...> Bar.bar([1,2,3])
7
defxp(head, list)

Define a private unary function with an implied subject

Examples

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