lambdass: Syntax sugar of making an anonymous function

Description Usage Arguments Examples

Description

Syntax sugar of making an anonymous function

Usage

1
2
3
4
5
6
7
as.formals(x, value = list(quote(expr = )))

is.formals(y)

f.r(..., env_ = parent.frame())

f.(...)

Arguments

x

coerced to character (internally STRSXP).

value

a default value for making formal parameters.

y

expected to be a pairlist object which is all different named.

...

If one argument is passed, that is parsed as lambda's body. If two or more argument is passed, the last part is parsed as lambda's body and the rest are parsed as formal parameters for lambda.

env_

an environment in which call object is evaluated.

Examples

1
2
3
4
 f.(x, x + 1) # => function(x) x + 1
 f.(x, f.(y, x + y)) # => semantics is: function(x) function(y) x + y
 Reduce(f.(x, y, x + y), 1:10) # => 55
 Filter(f.(x, x %% 2 == 0), 1:10) # => c(2L, 4L, 6L, 8L, 10L)

TobCap/lambdass documentation built on May 9, 2019, 4:50 p.m.