;;;;This is a brief example of a Scheme ;;;; program with SchemeDoc comments. ;;;; .title SchemeDoc Demo ;;;; .author Kurt Normark ;;;; .affiliation Aalborg University, Denmark
;This comment is not extracted.
;;;Factorials. ;;; This section demonstrates a plain function. ;;; .section-id fac-stuff
;;The factorial functions. Also known as n!. ;; .parameter n An integer. ;; .pre-condition n >= 0. ;; .returns n * (n-1) * ... * 1

(define (fac n) (if (= n 0) 1 (* n (fac (- n 1)))))
;;;List selection functions. ;;; This section demonstrates two aliased functions. ;;; .section-id list-stuff
;;An alias of car. ;; .returns the first component of a cons cell ;; .form (head pair) ;; .parameter pair a cons cell

(define head car)
;;An alias of cdr. ;; .returns the second component of a cons cell. ;; .form (tail pair) ;; .parameter pair a cons cell

(define tail cdr)