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

foralls

foralls( 
s_formalVar
l_valueList
g_predicateExpr
)
=> t / nil
foralls(
s_key
o_table
g_predicateExpr
)
=> t / nil

Description

Checks if g_predicateExpr evaluates to non-nil for every element in l_valueList. In the SKILL++ mode, this function always locally wraps the loop or iterator local variable (s_formalVar) in a let block while compiling the code. Local wrapping preserves the lexical scope of the loop variable. This function may work slower than its non-wrapped counterpart forall. This is a syntax form.

Verifies that an expression remains true for every element in a list. The forall function can also be used to verify that an expression remains true for every key/value pair in an association table. The syntax for association table processing is provided in the second syntax statement.

Arguments

s_formalVar

Local variable usually referenced in g_predicateExpr.

l_valueList

List of elements that are bound to s_formalVar one at a time.

g_predicateExpr

A SKILL expression that usually uses the value of s_formalVar.

s_key

Key portion of the table entry.

o_table

Association table containing the entries to be processed.

Value Returned

t

If g_predicateExpr evaluates to non-nil for every element in l_valueList or for every key in an association table.

nil

If g_predicateExpr evaluates to nil for every element in l_valueList or for every key in an association table.

Examples

(defun test_forall (x)
    foralls( x (list x x+1 x+9) println(x))
    println(x)
    )
test_forall(9)
=> 9
9
nil

Also, see the example for the foreachs function.

Related Topics

Flow Control Functions


Return to top
 ⠀
X