Go to the first, previous, next, last section, table of contents.

list

list takes one or more arguments and constructs a list of those items. That is, a cdr-linked, null-terminated sequence of pairs is created, where each pair's car fields holds one of the values passed to list.

Notice that list is different from cons, in that the arguments are not lists in general--they're just any items that should be put into a list.

Intuitively, we often use cons to push one item onto a list that already exists, but we use list to create a list from scratch.

Notice that if we hand list just one argument, e.g., (list 1), that creates one pair whose cdr is null and whose car is the given argument. In contrast, if we use cons to create a one-element list, we must pass it that element and an empty list to serve as the cdr value: (cons 1 '()).


Go to the first, previous, next, last section, table of contents.