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

letseq

letseq(
 (
  ( s_var1 initExp1 )
  ( s_var2 initExp2 ) 
  ...
 )
body
)
=> g_result

Description

A letseq expression can be used in both SKILL and SKILL++ modes. The bindings and evaluations are performed sequentially.

Use letseq to control the order of evaluation of the initialization expressions. letseq is similar to let, but the bindings are performed sequentially from left to right, and the scope of a binding indicated by (var1 initExp1) is that part of the letseq expression to the right of the binding. Thus the second binding is done in an environment in which the first binding is visible, and so on.

This form is equivalent to a corresponding sequence of nested let expressions. It is also equivalent to let* is the standard Scheme syntax. This function is equivalent of let\*() but it is strongly recommended using this function over let\*().

Arguments

s_var

Name of a local variable. Each variable is assigned to the result of the corresponding initExp.

initExp

Expressions evaluated for the initial value. The initExps are evaluated sequentially in the environments that result from previous bindings.

body

A sequence of one or more expressions.

Value Returned

g_result

Value of the last expression of body.

Examples

letseq( ( ( x 1 ) ( y x+1 ) ) 
y
) ; letseq
=> 2

The example above is a more convenient equivalent to the code below in which you control the sequence explicitly by the nesting.

let( ( ( x 1 ) )
let( ( ( y x+1 ) )
y
)
)

Related Topics

Function and Program Structure


Return to top
 ⠀
X