Lecture overview -- Keyboard shortcut: 'u'  Previous page: Function definition in Scheme -- Keyboard shortcut: 'p'  Next page: Simple web-related functions (2) -- 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 2 - Page 44 : 46
Functional Programming in Scheme
Expressions, Types, and Functions
Simple web-related functions (1)

We will here give a simple example of a web-related function. Much more interesting examples will appear later in the material.

(define (www-document the-title . body-forms)
 (html
  (head (title the-title))
  (body body-forms)))

The definition of a www-document function. The www-document function is useful if you want to abstract the HTML envelope formed by the elements html, head, title, and body. If you need to pass attributes to html or body the proposed function is not adequate.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/document-abstractions/doc4.lamlA sample application of the function www-document.

Notice the way we pass a number of body contributions, which - as a list - are bound to the formal parameter body-forms.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/document-abstractions/doc4.lamlThe whole story - including the LAML context.