Content deleted Content added
→Lisp: copy editing |
→Lisp: copy editing |
||
Line 853:
</syntaxhighlight>
Because of their linear nature, alists are used for relatively small sets of data. [[Common Lisp]] also supports a [[hash table]] data type, and for [[Scheme (programming language)|Scheme]] they are implemented in [[Scheme Requests for Implementation|SRFI]] 69. Hash tables have greater overhead than alists, but provide much faster access when there are many elements. A further characteristic
Common Lisp hash tables are constructed via the <code>make-hash-table</code> function, whose arguments encompass, among other configurations, a predicate to test the entry key
<syntaxhighlight lang=Lisp>
Line 864:
</syntaxhighlight>
The <code>gethash</code> function permits
<syntaxhighlight lang=Lisp>
Line 870:
</syntaxhighlight>
Additionally,
<syntaxhighlight lang=Lisp>
Line 876:
</syntaxhighlight>
An invocation of <code>gethash</code> actually returns two values: the value or substitute value for the key and a boolean indicator,
<syntaxhighlight lang=Lisp>
Line 891:
</syntaxhighlight>
<code>clrhash</code> completely empties the
<syntaxhighlight lang=Lisp>
Line 897:
</syntaxhighlight>
The dedicated <code>maphash</code> function
<syntaxhighlight lang=Lisp>
Line 906:
</syntaxhighlight>
Alternatively, the <code>loop</code> construct makes provisions for iterations,
<syntaxhighlight lang=Lisp>
Line 921:
</syntaxhighlight>
A further option
<syntaxhighlight lang=Lisp>
Line 932:
</syntaxhighlight>
It is easy to construct composite abstract data types in Lisp, using structures
=== [[LPC (programming language)|LPC]] ===
|