Exercise 1.41

This commit is contained in:
Correl Roush 2014-06-02 11:41:46 -04:00
parent ef7ca0372e
commit 013bbded12

14
1-3.org
View file

@ -578,6 +578,20 @@ layout: org
(((double (double double)) inc) 5) (((double (double double)) inc) 5)
#+end_src #+end_src
----------------------------------------------------------------------
#+begin_src scheme :tangle yes
;; -------------------------------------------------------------------
;; Exercise 1.41
;; -------------------------------------------------------------------
(define (double f)
(lambda (x) (f (f x))))
(((double (double double)) inc) 5)
;Value: 21
#+end_src
** Exercise 1.42 ** Exercise 1.42
Let f and g be two one-argument functions. The "composition" f Let f and g be two one-argument functions. The "composition" f
after g is defined to be the function x |-> f(g(x)). Define a after g is defined to be the function x |-> f(g(x)). Define a