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

nlambda

nlambda( 
( 
s_formalArgument 
) 
g_expr1 ... 
) 
=> u_result

Description

(SKILL mode only) Allows nlambda functions to be defined without having names. In all other respects, nlambda is identical to nprocedure. This is a syntax form that is not supported in SKILL++ mode.

Allowing nlambda functions to be defined without having names is useful for writing temporary or local functions. In all other respects nlambda is identical to nprocedure.

An nlambda function should be declared to have a single formal argument. When evaluating an nlambda function, SKILL collects all the argument expressions unevaluated into a list and binds that list to the single formal argument. The body of the nlambda can selectively evaluate the elements of the argument list.

In general, it is preferable to use lambda instead of nlambda because lambda is more efficient. In most cases, nlambdas can be easily replaced by macros (and perhaps helper functions).

Arguments

s_formalArgument

Formal argument for the function definition.

g_expr1

SKILL expressions to be evaluated when the function is called.

Value Returned

u_result

A function object.

Examples

putd( 'foo nlambda( (x) println( x )))
=> funobj:0x309128
apply( nlambda((y) foreach(x y printf(x))) '("Hello" "World\n"))
HelloWorld
=> ("Hello" "World\n")

Related Topics

Function and Program Structure


Return to top
 ⠀
X