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

We will here show another simple function.

(define (indent-pixels p . contents)
  (table 'border "0"
   (tbody
     (tr 
      (td 'width (as-string p) "")
      (td 'width "*" contents)))))

The definition of the indent-pixel function. This is a function which we use in many web documents to indent the contents a number of pixels relative to its context. Here we implement the indentation by use of a table, in which the first column cell is empty. As we will se, other possibilities exist.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/indent-pixels-2.lamlAn alternative version of theindent-pixel function.

This version uses Cascading Style Sheets expressiveness. As it appears, this is a more compact, and more direct way of achieving our indentation goal.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/indent-pixels-2.lamlA sample application of indent-pixel with some initial LAML context (software loading).

Notice the use of the XHTML mirror.