Language constructs


Functions

muse_cell syntax_if (muse_env *env, void *context, muse_cell args)
 (if cond-expr then-expr [else-expr]).
muse_cell syntax_cond (muse_env *env, void *context, muse_cell args)
 cond is the generalization of if-then-else nested blocks.
muse_cell syntax_do (muse_env *env, void *context, muse_cell args)
 (do <expressions>).
muse_cell syntax_while (muse_env *env, void *context, muse_cell args)
 (while bool-expr <body>).
muse_cell syntax_for (muse_env *env, void *context, muse_cell args)
 (for init-expr cond-expr step-expr body [result-expr]).
muse_cell fn_stats (muse_env *env, void *context, muse_cell args)
 (stats).

Function Documentation

muse_cell syntax_if ( muse_env env,
void *  context,
muse_cell  args 
)

(if cond-expr then-expr [else-expr]).

Evaluate the cond-expr first. If the cond-expr evaluates to something that's not (), the if expression evaluates to the result of the then-expr. If an else-expr is supplied and the cond-expr evaluated to (), the result will be the evaluation of the else-expr. If no else-expr is supplied and the condition failed to test, then () is the result.

For example -

 (if (= 1 2)
     (print "muSE doesn't know numbers!")
     (print "muSE knows numbers, alright"))

muse_cell syntax_cond ( muse_env env,
void *  context,
muse_cell  args 
)

cond is the generalization of if-then-else nested blocks.

 (cond
    (test1 result1)
    (test2 result2)
    ...
    (T else))
The above form will first check whether test1 is satisfied. If it is, then the result will be the evaluation of result1. If not, then test2 is checked, and so on. For example -
 (cond
    ((< a b) (print "a < b"))
    ((< a c) (print "a < c, but not b"))
    (T (print "a is >= b and c")))

muse_cell syntax_do ( muse_env env,
void *  context,
muse_cell  args 
)

(do <expressions>).

Defines an expression block. The result of the do block is the result of the last expression in the block, after evaluating all the expressions in the block in sequence.

muse_cell syntax_while ( muse_env env,
void *  context,
muse_cell  args 
)

(while bool-expr <body>).

Repeatedly evaluates the body statements as long as the bool-expr expression evaluates to something non-nil.

muse_cell syntax_for ( muse_env env,
void *  context,
muse_cell  args 
)

(for init-expr cond-expr step-expr body [result-expr]).

For-loop must be obvious to all ye C-fans. ex:

        (for (set! i (dup 0)) (< i 1000) (++ i)
         (do (set! j (+ j (* i i)))
             (print j))
         j)

muse_cell fn_stats ( muse_env env,
void *  context,
muse_cell  args 
)

(stats).

Evaluates to a triplet

 (free-cells stack-size num-symbols) 
.


Generated on Mon Sep 25 23:12:50 2006 for muSE by  doxygen 1.4.7