SICP Exercise 1.41 double

Exercise 1.41.  Define a procedure double that takes a procedure of one argument as argument and returns a procedure that applies the original procedure twice. For example, if inc is a procedure that adds 1 to its argument, then (double inc) should be a procedure that adds 2. What value is returned by



(((double (double double)) inc) 5)

SOLUTION

The code and tests are here.

Comments

Popular posts from this blog

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions

SICP Exercise 3.13 make-cycle

SICP Exercise 3.45 deadlock