Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

defmacro

defmacro( 
s_macroName 
( l_formalArglist ) 
g_expr1 ... 
)
=> s_macroName

Description

Defines a macro which can take a list of formal arguments including @optional, @key, and @rest (instead of the more restrictive format as required by using mprocedure).

The arguments will be matched against the formals before evaluating the body.

Arguments

s_macroName

Name of the macro you are defining.

l_formalArglist

Formal argument list.

g_expr1

Expression or expressions to be evaluated.

Value Returned

s_macroName

The name of the macro being defined.

Examples

defmacro( whenNot (cond @rest body)
‘(if ! ,cond then ,@body) )
=> whenNot
expandMacro( '(whenNot x > y z = f(y) x*z) )
=> if(!(x > y) then (z = (f y))(x * z))
whenNot(1 > 2 "hello" 1+2)
=> 3

Related Topics

Function and Program Structure


Return to top
 ⠀
X