Data and Aggregate Types

The current value space contains booleans, exact and inexact numbers, characters, symbols, strings, the empty list, pairs, vectors, bytevectors, procedures, and escape continuations.

When this matters

Choose the smallest value shape that communicates the job: an atom for one fact, a proper list for sequential data, a vector for indexed mutable slots, or a bytevector for bounded bytes.

See it run

LISPEX
(list (vector? #(1 2)) (bytevector? #u8(1 2)) (pair? (cons 1 2)))

Observed result

OUTPUT
(#t #t #t)

Read the example

The example asks three predicates about three different aggregate values. Each constructor creates the documented kind of value, so the result is a list of three true booleans.

How to reason about it

  • Pairs, strings, and bytevectors are immutable in the current profile; vectors and lexical cells are mutable.
  • Quoted aggregate data is immutable; constructors create runtime aggregates with the documented identity rules.
  • Improper and cyclic structures are distinguished from proper lists; deep equality terminates on cycles.

Choose quickly

Value familyTypical spellingMutation in the current profile
atoms#t, 42, 2/3, name, #\\anot applicable
list / pair(list 1 2), (cons 1 2)immutable
string"hello"immutable
vector#(1 2) or (vector 1 2)mutable slots
bytevector#u8(1 2)immutable
procedure(lambda (x) x)callable value; body is not data

A common mistake

Complex numbers, ports, records, and mutable pairs or strings are outside the current profile.

Current boundaries

  • Internal outcomes, signals, and uninitialized sentinels are not guest values.

Keep going

List and Aggregate Procedures gives constructors and accessors. Equality explains identity versus structural comparison.

List and aggregate procedures · Equality