next up previous contents
Next: 6. Expressions Up: QScheme Documentation Previous: 4. Ignore this   Contents

Subsections

5. QScheme extensions and deviations

5.1 Comments

QScheme accept the standard ';' character as standard comment maker. Anything following the ';' character on the line is ignored.

QScheme also reconizes '#!' followed by anything except a letter as commentary. For example:

#! This is a valid comment

#!/this also

#!This not

This extension is used to permit QScheme scripting.

5.2 Case sensitive

QScheme is case sensitive: define is not the same as DEFINE. It generaly should not be a problem. If this cause too much troubles, contact me. It should be possible to write a compatibility mode.

5.3 Keywords

QScheme reconizes the following tokens as valid keywords:

All of this is represent the same keyword.

By default, keywords are printed out in the first form. You can change this with the keyword-display-type function.

(keyword-display-type n) -> n
Change the way keywords are displayed. For example:

> (keyword-display-type 0) :ake

> :ake

> (keyword-display-type 1) :ake

> #!ake

> (keyword-display-type 2) :ake

> ake:

5.4 lambda and define syntax

QScheme introduce a new form of lambda and define syntax:

(lambda (formal [:opt var ] [:local local-vars])body) -> <procedure>

(define (func formal [:opt var ] [:local local-vars])body) -> #undefined

The formal parameters are just like in standard Scheme. The optional part ':opt var' can be used to an optional variable and the ':local local-vars' part is used to create local variables. For example:

(lambda (x y :opt z) ...) is equivalent to (lambda (x y . z) ...)

and

(lambda (x y :opt a b)...) is equivalent to (lambda (x y) (let ((a) (b)) ...)

The define special form also uses the same convention, so you should be able to say:

(define (tst x y :local sum) (set! sum (+ x y)) sum)

(tst 10 20)

=> 30

Note:
Please don't use this extension if you want your code to run on other scheme implementations.


next up previous contents
Next: 6. Expressions Up: QScheme Documentation Previous: 4. Ignore this   Contents
Daniel Crettol
1999-09-17