          Lecture 4 - Page 30 : 34
 Functional Programming in SchemeHigher-order Functions * Introduction to higher-order functions Higher-order functions Some simple and general higher-order functions Linear search in lists Generation of list selectors * Mapping and filtering Classical higher-order functions: Overview Mapping The mapping function Examples of mapping Filtering The filtering function Examples of filtering * Reduction and zipping Reduction The reduction functions Accumulation Zipping The zipping function * Currying The idea of currying Currying in Scheme Examples of currying Ad hoc currying in Scheme (1) Ad hoc currying in Scheme (2) * Web related higher-order functions HTML mirror generation HTML mirror usage examples Making tables with the real mirror Tables with higher-order functions HTML element modifications The function simple-html-table The XHTML mirror in LAML Generation of a leq predicate from enumeration
 Tables with higher-order functions
 Instead of explicit composition of td and tr elements we can use a mapping to apply tr to rows and td to elements
Expression

Value

```(define rows
'(("This" "is" "first" "row")
("This" "is" "second" "row")
("This" "is" "third" "row")
("This" "is" "fourth" "row"))
)

(table 'border 5
(gmap
(compose tr (gmap td)) rows))```
 This is first row This is second row This is third row This is fourth row

In the table expression we map - at the outer level - a composition of tr and a td-mapper. The td-mapper is made by (gmap td).

 The last example illustrates that (gmap td) is a useful building block, which can be composed with other functions.The last example depends on the fact that the HTML mirror functions accept lists of elements and attributes.