Collections3 exports
Raw Markdown/func
Higher-order function utilities including partial application, currying, composition, and memoization.
Functions & symbols#
apply#
function
Calls `func` with elements of `args` unpacked as positional arguments.
| Parameter | Type | Optional | Description |
|---|---|---|---|
func | Func | required | Invocable function |
args | Array | required | Argument Array to spread into `func` |
Returns:
Any(func/apply + [1 2 3 4]) ; -> 10curry#
function
Curries a multi-parameter function into nested single-argument closures.
| Parameter | Type | Optional | Description |
|---|---|---|---|
func | Func | required | Multi-parameter function to convert into single-argument curried form |
Returns:
Any(let add5 ((func/curry (Func [a b] (+ a b))) 5))memoize#
function
Returns a memoized wrapper around `func` caching computed outputs by argument tuple.
| Parameter | Type | Optional | Description |
|---|---|---|---|
func | Func | required | Pure function to wrap with an argument->result cache |
Returns:
Any(let fast-fib (func/memoize slow-fib))