List and Aggregate Procedures

Lists, pairs, vectors, and bytevectors have explicit proper-list, index, identity, and mutation boundaries.

See it run

LISPEX
(list (list-ref (list 10 20 30) 1) (vector-ref #(4 5) 0))

Observed result

OUTPUT
(20 4)

How to reason about it

  • List access/search includes the c...r family, list-ref, list-tail, member/assoc variants, copy, append, reverse, and constructors.
  • Vector construction, access, copy, map, and vector-set! are available. Bytevectors are read-only in this profile.
  • Bad pair/list domains are E310, bad indices or ranges are E311, and wrong primitive types are E312.

Aggregate signatures

SignatureResult / identityFault
(cons a d)fresh pairnone
(car pair) / (cdr pair)stored componentE310 non-pair
(list-ref proper-list k)k-th elementE312 non-integer, E311 range, E310 list that does not end properly
(vector-ref vector k) / (vector-set! vector k value)element / zero values, and the vector keeps its identityE312 type, E311 range
(bytevector-u8-ref bytevector k)exact integer 0..255E312 type, E311 range

A common mistake

Pair and bytevector mutators are deferred, and quoted aggregates cannot be mutated.

Keep going

The manual says which aggregates exist and which of them can be mutated, and the index places these names among the other families.

Data and Aggregate Types · Procedure Index