next up previous contents
Next: 7. QScheme procedures Up: QScheme Documentation Previous: 5. QScheme extensions and   Contents

Subsections

6. Expressions

6.1 Primitive expressions types

(quote (datum)) -> <list> 
'(datum) -> <list>

(operator operand1 ...) -> <object>

(lambda formals body) -> <procedure>
(define (name arg ...) body) -> #undefined

(define variable expr) -> #undefined 
(set! variable expr) -> #undefined

(if test when-true when-false) -> <object> 
(if test when-true) -> <object>

(while test body) -> <object>

(begin expr ...) -> <object>

See R5RS.

QScheme make a strong distinction between define and set!. define creates a new symbol in the current environment and binds a value to it, set! does not create any symbol. Setting a value to an undefined symbol will cause an error. This distinction is needed especially for the external variable. There, you have to use define to create a new symbol and bind the symbol to the external variable location and set! to assign a new value to the external variable. Example:

(define testvar-b (extern-var *lib* "extern-char"  "testvar_b"))

testvar-b

=> 10

(set! testvar-b 20) testvar-b

=> 20

In this case, the define variable testvar-b is bounded to an external variable object. References to this variable will return the value of the object, not the binding. Set! will modify the value of the external variable, not the binding. This should be compatible with the R5RS specs.

6.2 Derived expressions

(cond clause1 clause2 ...) -> <object>  
(and test1 ...) -> <object>  
(or test1 ... ) -> <object>

See R5RS.

(case key clause1 clause2 ...) -> <object>

Not implemented yet

(let binding body) -> <object>  
(let* binding body) -> <object>  
(letrec binding body) -> <object>

See R5RS.

(begin expr1 expr2 ...) -> <object> 
(do ((var1 init1 step1 ) ... ) (test expr ... ) command ...) -> <object>

See R5RS.

(let var bindings body) -> <object>

Not implemented yet

(delay expr) -> <object>

Not implemented yet.

(quasiquote (template)) -> <object>  
`(template)) -> <object>

See R5RS


next up previous contents
Next: 7. QScheme procedures Up: QScheme Documentation Previous: 5. QScheme extensions and   Contents
Daniel Crettol
1999-09-17