Ch 4 Flashcards
In Scheme, the primitive (char? “%\A”) will return…
f
(member ‘2 ‘(3 4 2 1)) will return…
(2 1)
(caddr ‘(2 4 6 8 10)) will return…
6
The most efficient way, in terms of the execution time, to check whether a list L is empty is by…
(NULL? L)
Which of the following forms is an unnamed procedure?
(+ z 3)
((lambda (z) (+z 3)) 4)
(define foo (lambda (z) (+ z 3)))
(define bar 25)
None of them
((lambda (z) (+ z 3)) 4)
Eager evaluation evaluates…
all parameters of a function first.
Lazy evaluation evaluates…
a parameter of a function only if it is necessary.
In “imperative” programming languages, different orders of evaluations (eager or lazy)…
may produce different results.
In “functional” programming languages, different orders of evaluations (eager or lazy)…
never produce different results.
Each let-form in Scheme can be converted into…
an unnamed procedure.
Assume that you have (define x ‘(5)) and (define y ‘(8 9)). What operation will return the list (5 8 9)?
(append x y)
Which of the followings is NOT a Scheme pair?
’()
What is the return value of the following form?
(filter (lambda (x) (> x 20)) ‘(10 30 15 10 80))
(30 80)
A deep-filter can be used in the situation where the list…
contains sublists.
What is the return value of the following form?
(map (lambda (x) (+ x 10)) ‘(10 30 15))
(20 40 25)