## `fp::fixargs` -- create function by fixing all but one argument

#### Introduction

`fp::fixargs``(f,1,y)` returns the function x -> f(x,y).

#### Call(s)

`fp::fixargs(f, n <, e...>)`

#### Parameters

`f` | - | function
`n` | - | positive integer defining free argument
`e` | - | object used as fixed argument

#### Returns

An unary function.

#### Details

- `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...`.
- Thus, given a m-ary function f and m-1 values e[1],...e[m-1], `fp::fixargs` returns the function

      x -> f(e[1],...e[n-1],x,e[n],...e[m-1])

#### Example 1

Fix the first and third argument of `f` to `x1` and `x3`:

    >> fp::fixargs(f, 2, x1, x3)(y)

                                   f(x1, y, x3)

#### Example 2

Create a function which increments its argument by one:

    >> inc := fp::fixargs(_plus, 1, 1):
       inc(x)

                                       x + 1

#### Example 3

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]

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000