Higher-Order Programming » Lab Sessions

Session 0 (Solutions)

Lecturer: Jens Nicolay (jens.nicolay@vub.be) Assistant: Bjarno Oeyen (bjarno.oeyen@vub.be)

Numbers, Strings, Booleans...

Exercise 1





Each of these expressions evaluates to itself, with the exception of the procedures.

modulo, even?, +, >= and string-length are symbols that evaluate to a procedure.

Combinations

Exercise 2





Side note: Guy L. Steele and Gerald Jay Sussman are the names of the original designers of the Scheme programming language.

Exercise 3

$$e_1 = \frac{a + b}{2}$$





$$e_2 = \frac{a + b}{e} - \frac{c + d}{f}$$





$$e_3 = a\times{}a + 2\times{}a\times{}b + b\times{}b$$





$$e4 = \frac{a + \frac{b}{c}}{d} \times \frac{e}{\frac{g}{i} - h}$$





Procedures

Exercise 4





Exercise 5





Exercise 6





And, the other way around.





Exercise 7