Some Sample Code This document is intended to give SamR a bit of a chance to experiment with the ways in which we might write code using DocBook.
Scheme Code Here, we just have a sample bit of Scheme code, entered directly within the DocBook file. ;;; Procedure: ;;; square ;;; Parameters: ;;; x, a number ;;; Purpose: ;;; Computes the square of x ;;; Produces: ;;; x-squared, a number ;;; Preconditions: ;;; [No additional.] ;;; Postconditions: ;;; x-squared should have the same "type" as x. For example, ;;; if x is an integer, x squared is also an integer; ;;; if x is exact, x squared is also exact. ;;; x-squared = x * x (define square (lambda (x) (* x x)))
Inserted Code To get this to compile correctly, we need to add the --xinclude flag to xsltproc.
Sample Interaction > (square 4) 16 > (square "hello") Error: *: First parameter is not a number. > (read) Hello world! Hello world! >> (print "Hello world!") #t Hello world!
Fun with entities [&title-prefix;]
A Full Procedure Head (foo bar baz)
Fun with Links Don't you just love association lists? Don't you wnat to return to the beginning?
HTML Tables
n log2n n2 n2/4 nlog2n
10 3.3 100 25 33
20 4.3 400 100 86
30 4.9 900 225 147
40 5.3 1,600 400 212
100 6.6 10,000 2,500 660
500 9.0 250,000 62,500 4,483
1000 10.0 1,000,000 250,000 10,000