Useful Tacit function
1 Fork
fork
fork2
8.18

Useful Tacit function🔗ℹ

Laurent Müller <loeru@pm.me>

 (require tacit) package: Tacit

Useful functions

source code: https://github.com/lurry-m/tacit

1 Fork🔗ℹ

syntax

(fork (first ...) second ...)

Returns the a unary function that applies the all the second arguments to the input and then the first arguments on the result.

Examples:
> (define sum (curry apply +))
> (define average (fork1 (/) sum length))

fork1: undefined;

 cannot reference an identifier before its definition

  in module: top-level

> (average (range 10))

average: undefined;

 cannot reference an identifier before its definition

  in module: top-level

syntax

(fork2 (first ...) second ...)

Returns the a binary function that applies the all the second arguments to the input and then the first arguments on the result.

Example:
> ((fork2 (list) + *) 5 7)

'(12 35)