Content deleted Content added
→KornShell 93 (and compliant shells: ksh93, bash4...): copy editing |
→Lisp: copy editing and linking |
||
Line 721:
</syntaxhighlight>
===
[[Lisp programming language|Lisp]] was originally conceived as a "LISt Processing" language, and one of its most important data types is the linked list, which can be treated as an [[association list]] ("alist").
<syntaxhighlight lang=Lisp>
Line 730:
</syntaxhighlight>
The syntax <code>(x . y)</code> is used to indicate a [[cons|<code>cons</code>ed]] pair. Keys and values need not be the same type within an alist. Lisp and [[Scheme (programming language)|Scheme]] provide operators such as <code>assoc</code> to manipulate alists in ways similar to associative arrays.
A set of operations specific to the handling of association lists exists for [[Common Lisp]], each of these working non-destructively.
To add an entry the <code>acons</code> function is employed, creating and returning a new association list. An association list in Common Lisp mimicks a stack, that is, adheres to the last-in-first-out (LIFO) principle, and hence prepends to the list head.
Line 743:
</syntaxhighlight>
This function can
<syntaxhighlight lang=Lisp>
Line 760:
</syntaxhighlight>
Searching for an entry by its key is performed via <code>assoc</code>, which might be configured regarding the test predicate and direction, especially searching
<syntaxhighlight lang=Lisp>
|