compileComplexExpression

Compiles a complex expression once, with its parameters fixed, into a function of its variables, or returns null when the expression is refused.

@internote/canvas-sdkFunction
On this page
import { compileComplexExpression } from '@internote/canvas-sdk';

For the samplers that call an expression thousands of times over a window. The function takes the variables in the order given, real or complex, and returns null for a sample that fails or comes out non-finite.

#Signature

(
    js: string,
    variables: string[],
    params: Record<string, number>,
): ((...args: Array<number | Complex>) => Complex | null) | null

#Parameters

js
The expression's JavaScript, as a refined complex expression's js.
variables
The formals the caller supplies per sample, in order.
params
The parameter values, which ride along fixed.

#Example

const f = compileComplexExpression(expression.js, ['z'], ctx.parameters.numbers());
const w = f?.({ re: 1, im: 2 });

Declared in packages/canvas-sdk/src/maths/complex.ts:207.

Last updated