Witchcraft v0.3.0 Witchcraft.Applicative.Function

Function helpers, derivatives and operators for Witchcraft.Applicative

Summary

Functions

lift a function that takes a list of arguments

Sequentially apply, and discard the second value of each pair

Sequentially apply, and discard the first value of each pair

Functions

lift(list, fun)

Specs

lift(any, (... -> any)) :: any

lift a function that takes a list of arguments


iex> lift([[1,2,3], [4,5,6]], &(&1 + &2))
[5,6,7,6,7,8,7,8,9]

iex> lift([[1,2], [3,4], [5,6]], &(&1 + &2 + &3))
[9,10,10,11,10,11,11,12]

iex> lift([[1,2], [3,4], [5,6], [7,8]], &(&1 + &2 + &3 + &4))
[16,17,17,18,17,18,18,19,17,18,18,19,18,19,19,20]
seq_first(list)

Specs

seq_first([any]) :: any

Sequentially apply, and discard the second value of each pair.

seq_second(list)

Specs

seq_second([any]) :: any

Sequentially apply, and discard the first value of each pair.