THE LIST ABSTRACTION

We've been lying to you. Sentences are not part of standard Scheme. Lists are. Here are many of the differences in a handy reference.

Sentences versus Lists

FUNCTION TYPE           SENTENCES           LISTS
--------------------------------------------------------
Constructor(s)          sentence, se        list (any number of any inputs)
                                            cons (creates EXACTLY one new pair)
                                            append (any number of lists as inputs)

Selectors/Accessors     first               car
                        butfirst            cdr
                        last                --
                        butlast             --
                        item (starts 1)     list-ref (starts 0)
                        count               length

Predicate               empty?              null?
                        --                  pair?
                        sentence?           list?
                        equal?              equal?   (equal? not really a sentence or list function)

Higher-Order Functions  every               map
                        keep                filter
                        accumulate          reduce

Mutators/Modifiers      AP Computer Science
                        (Some of this is in chapter 23)

Additional notes:

  1. Sentences cannot contain other sentences; lists can contain other lists.
  2. Sentences contain only words; lists can contain anything, including booleans and functions.
  3. All sentences are lists; lists may or may not be sentences