Exercises

Exercise 6.1.   [*] Define numbers-to-strings from exercise 1.2 with

Use the language level
IS w/ lambda
one of the loops. 

Exercise 6.2.   Use build-list to design the function count-down, which consumes a natural number n and produces the list of numbers n ...0

Exercise 6.3.   [*] Define the functions line and make-rectangle (see exercise 2.1 for the original definitions) with loops. 

Exercise 6.4.   Define which-toppings and allergic from exercises 1.3 and 5.1, respectively, with loops. 

Exercise 6.5.   Use loops to define numeric-matrix? (see exercise 3.3). 

Exercise 6.6.   [*] Use Scheme’s loops to develop the function build-rectangle. It consumes two natural numbers: n and m. Its result is a rectanglular S-expression such as this:

(list
  (list 'tr (list 'td "cell00") (list 'td "cell01"))
  (list 'tr (list 'td "cell10") (list 'td "cell11"))
  (list 'tr (list 'td "cell20") (list 'td "cell21"))
  (list 'tr (list 'td "cell30") (list 'td "cell31")))

with 4 rows and 2 columns. 

Exercise 6.7.   [*] Use foldr to define the function add-blocks, which consumes a list of Posns and places squares at these positions into an empty scene. 

Exercise 6.8.   Develop the function draw-stars, which consumes a natural number

Add the teachpack
draw.ss
n and creates a blue canvas of 100 x 100 pixels with n yellow disks of radius 2