foralls
foralls(s_formalVar l_valueList g_predicateExpr) =>t/nilforalls(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
|
List of elements that are bound to s_formalVar one at a time. |
|
|
A SKILL expression that usually uses the value of s_formalVar. |
|
Value Returned
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
Return to top