Lecture overview -- Keyboard shortcut: 'u'  Previous page: HTML element modifications -- Keyboard shortcut: 'p'  Next page: The XHTML mirror in LAML -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 4 - Page 32 : 34
Functional Programming in Scheme
Higher-order Functions
The function simple-html-table

In an earlier exercise - 'restructuring of lists' - we have used the function simple-html-table

We will now show how it can be implemented

(define simple-html-table 
 (lambda (column-widht list-of-rows)
  (let ((gmap (curry-generalized map))
        (td-width 
          (modify-element td 'width
                          (as-string column-widht))))
    (table 
      'border 1
      (tbody 
       (gmap (compose tr (gmap td-width)) list-of-rows))))))

The function simple-html-table. Locally we bind gmap to the curry generalized map function. We also create a specialized version of td, which includes a width attribute the value of which is passed as parameter to simple-html-table . In the body of the let construct we create the table in the same way as we have seen earlier in this lecture.