setof
setof(s_formalVarl_valueListg_predicateExpression) =>l_result
setof( ( s_formalVar1... s_formalVarN )l_valueList1 ... l_valueListN g_predicateExpression) =>l_valueList/l_result
setof(s_formalVaro_tableg_predicateExpression) =>l_result
Description
Returns a new list containing only those elements in a list or the keys in an association table that satisfy an expression. This is a syntax form.
The setof form can also be used to identify all keys in an association table that satisfy the specified expression.
Arguments
Value Returned
|
New list containing only those elements in l_valueList that satisfy g_predicateExpression, or list of all keys that satisfy the specified expression. |
Examples
setof( x '(1 2 3 4) (x > 2) )
=> (3 4)
setof( x '(1 2 3 4) (x < 3) )
=> (1 2)
setof( (x y) '(1 2 3) '(4 5 6) oddp(x) && evenp(y))
=> (1 3)
myTable = makeTable("atable" 0)
=> table:atable
myTable["a"]="first"
=> "first"
myTable["b"]=2
=> 2
setof(key myTable (and (stringp key)(stringp myTable[key])))
=> ("a")
Related Topics
Return to top