Lecture overview -- Keyboard shortcut: 'u'  Previous page: HTML mirror generation -- Keyboard shortcut: 'p'  Next page: Making tables with the real mirror -- 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 28 : 34
Functional Programming in Scheme
Higher-order Functions
HTML mirror usage examples

The example assumes loading of laml.scm and the function map-concat, which concatenates the result of a map application.

The real mirrors use implicit (string) concatenation

Expression

Value

(let* ((functions
         (map generate-double-tag-function 
              (list "table" "td" "tr")))
       (table (car functions))
       (td (cadr functions))
       (tr (caddr functions)))
 (table
  (string-append
   (tr 
     (map-concat td (list "c1" "c2" "c3"))
     'bgcolor "#ff0000")
   (tr
     (map-concat td (list "c4" "c5" "c6")))
   (tr
     (map-concat td (list "c7" "c8" "c9"))))
  'border 3))
<table border="3">
   <tr bgcolor="#ff0000">
     <td> c1 </td>
     <td> c2 </td> 
     <td> c3 </td>  
   </tr>
   <tr> 
     <td> c4 </td> 
     <td> c5 </td>
     <td> c6 </td>
   </tr>
   <tr> 
     <td> c7 </td>
     <td> c8 </td>
     <td> c9 </td>
   </tr>
</table>
Same as above
c1 c2 c3
c4 c5 c6
c7 c8 c9

An example usage of the simple HTML mirror which we programmed on the previous page. The bottom example shows, as in earlier similar tables, the HTML rendering of the constructed table. The map-concat function used in the example is defined in the general LAML library as (define (map-concat f lst) (apply string-append (map f lst))). In order to actually evaluate the expression you should load laml.scm of the LAML distribution first.