associate
|
The associate funtion returns the first pair in a List {list}
of Pairs whose car component matches the object key {key}. If no Pair in
the target List has a car component matching the key, then false is returned.
The target must be a List each of whose elements are Pairs. Usage The associate function is used to find the Pair of a specific key.
For instance the following Lisp code shows how to built a List of Pairs,
and then how to find the Pair associated with the specified key.
(setq trees '((pine . cones) (oak . acorns) (maple . seeds))) ;; == >((pine . cones) (oak . acorns) (maple . seeds))
(associate 'oak trees) ;; ==> (oak . acorns)
(cdr (associate 'oak trees)) ;; ==> acorns
(associate 'birch trees) ;; ==> false
(associate key list) ;; Return the Pair associated with the key in the list Return the Pair associated with the key in the list - or false.
Expression:
Arguments
Name
Type
Description Argument: key Word
The key whose associate is to be returned Argument: list Pair
The List of Pairs where the car is the key and the cdr is the associated value.
Returns:
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
Pair | List |
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
|