fp::fixargs
-- create function
by fixing all but one argumentfp::fixargs
(f,1,y)
returns the function
x -> f(x,y).
fp::fixargs(f, n <, e...>)
f |
- | function |
n |
- | positive integer defining free argument |
e |
- | object used as fixed argument |
An unary function.
fp::fixargs
returns an unary function, defined by
fixing all but the n
-th argument of the function
f
to the values given by e...
.fp::fixargs
returns the function
x -> f(e[1],...e[n-1],x,e[n],...e[m-1])
Fix the first and third argument of f
to
x1
and x3
:
>> fp::fixargs(f, 2, x1, x3)(y)
f(x1, y, x3)
Create a function which increments its argument by one:
>> inc := fp::fixargs(_plus, 1, 1): inc(x)
x + 1
Create a function which tests the identifier
x
for a type:
>> type_of_x := fp::fixargs(testtype, 2, x): map([DOM_INT, DOM_IDENT], type_of_x)
[FALSE, TRUE]