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

exists

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

Description

Returns the first tail of l_valueList whose car satisfies a predicate expression. Also verifies whether an entry in an association table satisfies a predicate expression. This is a syntax form.

This process continues to apply the cdr function successively through l_valueList until it finds a list element that causes g_predicateExpr to evaluate to non-nil. It then returns the tail that contains that list element as its first element.

This function can also be used to verify whether an entry in an association table satisfies g_predicateExpr.

Arguments

s_formalVar

Local variable that is usually referenced in g_predicateExpr.

l_valueList

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

g_predicateExpr

SKILL expression that usually uses the value of s_formalVar.

s_key

Key portion of an association table entry.

o_table

Association table containing the entries to be processed.

Value Returned

g_result

First tail of l_valueList whose car satisfies g_predicateExpr.

nil

If none of the elements in l_valueList can satisfy it.

t

Entry in an association table satisfies g_predicateExpr.

Examples

Tests an association table and verifies the existence of an entry where both the key and its corresponding value are of type string.

exists( x '(1 2 3 4) (x > 1) )  
=> (2 3 4)
exists( x '(1 2 3 4) (x > 4) ) 
=> nil
exists( key myTable (and (stringp key)
(stringp myTable[key])))
=> t

Related Topics

Flow Control Functions

car

cdr


Return to top
 ⠀
X