chickadee » spock » <spock>

(<spock> FORM)syntax

Compiles the Scheme (unquoted) expression FORM using the current compilation state and returns the generated JavaScript code as a string. FORM may contain sub-expressions of the form (<unscript> and <unscript-splicing>, respectively, which work similar to unquote and unquote-splicing in R5RS Scheme, but switch between code to be compiled and code or literal data to be computed in the host environment, e.g.

 (<spock>
   (begin
     (define (square x) (* x x))
     (print (square '(<unscript> (read))))))

will return a <script> HTML element containing JavaScript code that defines a function and calls it with the argument read at execution of the <spock> expression.

Note that the compiled form needs runtime support code to execute successfully. See <spock-header> below.