%+% {garray} | R Documentation |
Function composition operator
Description
Composite functions a
and b
into a(b(...))
.
Usage
a %+% b
Arguments
a |
A function that can be called with one argument. |
b |
A function that can be called with one or more argument,
and result of |
Value
A new function, whose
arguments are what b()
can accept, and whose result is what a()
can return.
Examples
lse <- log%+%sum%+%exp
lse(1:10)
#logsumexp(1:10) # actual logsumexp() is more sophistic
log(sum(exp(1:10)))
sum <- sd
lse(1:10) # lse() is fixed at definition
log(sum(exp(1:10)))
(log%+%sum%+%exp)(1:10) # now is (log%+%sd%+%exp)
[Package garray version 1.1.2 Index]