[previous] [up] [next]     [index]
Next: Boxes Up: Basic Data Extensions Previous: Vectors

Lists

A cons cell can be mutable or immutable. When an immutable cons cell is provided to a procedure like set-cdr!, the exn:application:type exception is raised.

Cons cells generated by read are always mutable. (pair->immutable-pair pair) returns an immutable pair with the same car and cdr as pair, returning pair if it is already an immutable cons cell.

The global variable null is bound to the empty list.

(reverse! list) is the same as (reverse list), but list is destructively reversed.

(append! list tex2html_wrap_inline100183 ) destructively appends the lists.

(list* v tex2html_wrap_inline100183 ) is similar to (list v tex2html_wrap_inline100183 ) but the last argument is used directly as the cdr of the last pair constructed for the list:

  (list* 1 2 3 4) ; => (1 2 3 . 4) 

The list-ref and list-tail procedures accept an improper list as a first argument. If either procedure is applied to an improper list and an index that would require taking the car or cdr of a non-cons-cell, the exn:application:mismatch exception is raised.

The member, memv, and memq procedures accept an improper list as a second argument. If the membership search reaches the improper tail, the exn:application:mismatch exception is raised.

The assoc, assv, and assq procedures accept an improperly formed association list as a second argument. If the association search reaches an improper list tail or a list element that is not a pair, the exn:application:mismatch exception is raised.



PLT