Algosim documentation: FcnExpr

FcnExpr

Returns the abstract syntax tree of a user-defined function.

Syntax

Description

If f is a user-defined function, then FcnExpr(f, b) returns the abstract syntax tree of f printed to a string. Iff b is true, the tree is printed in strict mode, in which the arguments are indicated by parenthesised numbers specifying their positions; otherwise, the arguments are named as in the original definition of f. b defaults to false.

Examples

f ≔ n ↦ n^2 + 1
custom function
FcnExpr(f, true)
FCN_Add
    FCN_Power
        (1)
        2
    1
FcnExpr(f, false)
Arguments: n
FCN_Add
    FCN_Power
        n
        2
    1