| 1 |
<!DOCTYPE example PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" |
| 2 |
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> |
| 3 |
<example><title>A DSSSL Function</title> |
| 4 |
<programlisting> |
| 5 |
(define (node-list-filter-by-gi nodelist gilist) |
| 6 |
;; Returns the node-list that contains every element of the original |
| 7 |
;; nodelist whose gi is in gilist |
| 8 |
(let loop ((result (empty-node-list)) (nl nodelist)) |
| 9 |
(if (node-list-empty? nl) |
| 10 |
result |
| 11 |
(if (member (gi (node-list-first nl)) gilist) |
| 12 |
(loop (node-list result (node-list-first nl)) |
| 13 |
(node-list-rest nl)) |
| 14 |
(loop result (node-list-rest nl)))))) |
| 15 |
</programlisting> |
| 16 |
</example> |