fp::fixargs

Create function by fixing all but one argument

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

fp::fixargs(f, n, <e, …>)

Description

fp::fixargs(f,1,y) returns the 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....

Thus, given a m-ary function f and m - 1 values e1, …, em - 1, fp::fixargs returns the function

Examples

Example 1

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

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

Example 2

Create a function which increments its argument by one:

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

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)

Parameters

f

Function

n

Positive integer defining free argument

e

Object used as fixed argument

Return Values

Unary function.