Exercises in this lecture  Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 3
Table Column Exercise


This exercises is oriented towards columns of tabular data.

Given three columns of numeric data. Each column is a list of numbers or boolean false values.

The column length may vary from column to column

As an example, the first column col1 may be the list:

  (1 5 #f 9 17)

This column may, together with two other columns, give the following table:


   1 15  8
   5 #f #f
  #f  0 11
   9  6 
  17 

Now, write a Scheme program supported by LAML that presents the table of columns. The table can be represented as the three individual columns. (And this is of course a little tricky, because HTML works with list of rows). #f values should be presented as blank table entries. In the fourth column, you should add the values in each row. When adding, the #f value and missing values (due to short columns) should be treated as 0.

Thus, a function call like (present-table table) should show this table.


Solution