You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
350 B
14 lines
350 B
2 years ago
|
|
||
|
Exercise 4.25: Suppose that (in ordinary
|
||
|
applicative-order Scheme) we define unless as shown above and then
|
||
|
define factorial in terms of unless as
|
||
|
|
||
|
|
||
|
(define (factorial n)
|
||
|
(unless (= n 1)
|
||
|
(* n (factorial (- n 1)))
|
||
|
1))
|
||
|
|
||
|
What happens if we attempt to evaluate (factorial 5)? Will our
|
||
|
definitions work in a normal-order language?
|