;;;; This is some introduction to a Scheme program. ;;;; .title SchemeDoc Demo Program ;;;; .author Kurt NÝrmark ;;;; .affiliation Department of Computer Science, Aalborg University, Denmark. ;;;; .scheme-source-linking true ;;;; .css-stylesheet argentina
;;; Section one. ;;; This is section one. The two functions in this section are documented by quite ;;; a few SchemeDoc tags. ;;; .section-id first
;; The function f adds to numbers. ;; .pre-condition Both a and b are numbers ;; .parameter x The first number ;; .parameter y The second number ;; .example (add 1 2) ;; .reference "Context" "SchemeDoc" "http://www.cs.auc.dk/~normark/schemedoc/" ;; .internal-references "next section" "second" ;; .internal-references "the other function" "subtract" ;; .class Arithmetic function ;; .misc Miscelaneous information ;; .essay <pre>\ ;; Here we can write some longer\ ;; story about the add function\ ;; on several lines using the line continuation character,\ ;; and using preformatted text by means\ ;; of the HTML pre tag.\ ;; </pre> ;; .post-condition The result is the sum of x and y ;; .returns Return the sum of x and y

(define (add x y) (+ x y))
;; The function f subtracts to numbers ;; .pre-condition Both a and b are numbers ;; .parameter x The first number ;; .parameter y The second number ;; .example (subtract 7 5) ;; .my-tag Some value ;; .reference "Context" "SchemeDoc" "http://www.cs.auc.dk/~normark/schemedoc/" ;; .internal-references "the other function" "add" ;; .post-condition The result is the difference between x and y ;; .returns Returns x - y ;; .class Arithmetic function

(define (subtract x y) (- x y))
;;; Section two. ;;; This is the second section, only with a couple of functions. The comment of these functions are ;;; not documented with a lot of SchemeDoc tags. ;;; .section-id second
;; Calculate the factorial of n ;; .class Arithmetic function

(define (fac n) (if (= 0 n) 1 (* n (fac (- n 1)))))
;; A function that returns a number of factorial numbers. ;; .class Application function

(define (sample-function) (map fac (list 5 10 15 20)))