signature

First introduced in version: 3.00.6

Syntax

signature(func)

Details

Return the signature and metadata of a specified function.

Arguments

func is a FUNCTIONDEF scalar. It can be a built-in function or a user-defined function.

Returns

An ordered dictionary with the following fields:

Field Description
name Function name. For an anonymous function, this field returns NULL.
description Function description recorded by @desc. If it is not specified, this field returns NULL.
returnAnnotation Return type annotation. If it is not specified, this field returns NULL.
parameters An ordered dictionary of argument names and argument type annotations. For an unannotated argument, the corresponding value is NULL.
maxParamCount Maximum number of arguments.
minParamCount Minimum number of arguments.
syntax Function syntax.
isView Whether the function is a function view.
isCommand Whether the function is a command.
isUserDefined Whether the function is user-defined.

Examples

@desc("Add two vectors and return a DOUBLE vector.")
def addVectors(a::INT VECTOR, b::DOUBLE VECTOR)::DOUBLE VECTOR {
    return double(a) + b
}

signature(addVectors)
/* output:
name->addVectors
description->Add two vectors and return a DOUBLE vector.
returnAnnotation->DOUBLE VECTOR
parameters->a->INT VECTOR
b->DOUBLE VECTOR

maxParamCount->2
minParamCount->2
syntax->(a,b)
isView->0
isCommand->0
isUserDefined->1
*/

Related functions: defs, funcByName