Lecture overview -- Keyboard shortcut: 'u'  Previous page: Symbolic expressions and improper lists -- Keyboard shortcut: 'p'  Next page: List functions -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Introduction to Functional Programming in Scheme - slide 14 : 49

Practical list construction
cons is the basic list constructor function - but it can be applied through a number of other means as well
 

Expression

Value

(cons 1 (cons 2 (cons (+ 1 2) '())))
(1 2 3)
(list 1 2 (+ 1 2))
(1 2 3)
(quote (1 2 (+ 1 2)))
(1 2 (+ 1 2))
'(1 2 (+ 1 2))
(1 2 (+ 1 2))
(quasiquote (1 2 (unquote (+ 1 2))))
(1 2 3)
`(1 2 ,(+ 1 2))
(1 2 3)
Go to exercise
Every second element of a list