Name: Anonymous 2013-01-28 0:59
/prog/ How do you do this?
Write the function mult-table which consumes two natural numbers nr and nc, and produces a list of nr lists, each of which contains nc natural numbers. The cth entry of the rth list (where we start numbering at 0) in the produced list should be r*c.
For example,
and
Hint: use build-list twice. The first time, try to make a list containing nr elements. Then, for each of these elements, make a list of nc elements. You may use other abstract list functions as well.
Write the function mult-table which consumes two natural numbers nr and nc, and produces a list of nr lists, each of which contains nc natural numbers. The cth entry of the rth list (where we start numbering at 0) in the produced list should be r*c.
For example,
(mult-table 2 3) => (list (list 0 0 0) (list 0 1 2))and
(mult-table 3 4) =>
(list (list 0 0 0 0)
(list 0 1 2 3)
(list 0 2 4 6)).Hint: use build-list twice. The first time, try to make a list containing nr elements. Then, for each of these elements, make a list of nc elements. You may use other abstract list functions as well.