;;;; 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
;;;; .schemedoc-dependencies "ex1"


;;; 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"
;; .misc Miscelaneous information
;; .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)
;;.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
(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
(define (fac n)
  (if (= 0 n) 1 (* n (fac (- n 1)))))

;; A function that returns a number of factorial numbers.
(define (sample-function)
  (map fac (list 5 10 15 20)))