Highlighting Scheme code is straight forward. The only thing you have to do is setting the type option of the '\sourcebegin' and '\sourceinput' commands to scm. Therefore this section is merely a demonstration of how a '.scm' file will look like. Notice however the comment style used in the Scheme source files. In order to be recognized by ProgDoc, comments can begin with one to four semicolons.
;; BEGIN Factorial (define factorial (lambda (n) (if (= n 1) 1 (* n (factorial (- n 1)))))) ;; END Factorial (string=? "K. Harper, M.D." ;; Taken from Section 6.3.3. (Symbols) of the R5RS (symbol->string (string->symbol "K. Harper, M.D."))) ;; BEGIN Square (define square (lambda (n) ;; My first lambda (if (= n 0) 0 ;; BEGIN Recursive_Call (+ (square (- n 1)) (- (+ n n) 1))))) ;; END Recursive_Call ;; END Square |
Notice that we used the command \renewcommand{ \pdCommentFont}{ \bfseries\itshape} in order to set the comment font of the listings beginning with Listing 12 to bold italic.
(define square (lambda (n) ;; My first lambda (if (= n 0) 0 <see Listing 14> |
(+ (square (- n 1)) (- (+ n n) 1))))) |