1 Scribble Layers
2 The Scribble Reader
3 Document Structures
4 Renderer
5 Text Decoder
6 Document Module Language
7 Document Reader
8 Basic Document Forms
9 PLT Manual Forms
10 Evaluation and Examples
11 PLT Reference Style Guide
On this page:
interaction
interaction-eval
interaction-eval-show
schemeblock+eval
schememod+eval
def+int
defs+int
examples
defexamples
current-int-namespace

contents

← prev  up  next →

 

10 Evaluation and Examples

The "eval.ss" library provides utilities for evaluating code at document-build time and incorporating the results in the document, especially to show example uses of defined procedures and syntax.

(interaction datum ...)

Like schemeinput, except that the result for each input datum is shown on the next line. The result is determined by evaluating the syntax-quoted form of the datum.

Uses of code:comment and code:blank are stipped from each datum before evaluation.

If a datum has the form (code:line code-datum (code:comment ...)), then only code-datum is evaluated.

If a datum has the form (eval:alts show-datum eval-datum), then show-datum is typeset, while eval-datum is evaluated.

(interaction-eval datum)

Evaluates the syntax-quoted form of each datum via do-eval and returns the empty string.

(interaction-eval-show datum)

Evaluates the syntax-quoted form of datum and produces an element represeting the printed form of the result.

(schemeblock+eval datum ...)

Combines schemeblock and interaction-eval.

(schememod+eval name datum ...)

Combines schememod and interaction-eval.

(def+int defn-datum expr-datum ...)

Like interaction, except the the defn-datum is typeset as for schemeblock (i.e., no prompt) with a line of space between the definition and the interactions.

(defs+int (defn-datum ...) expr-datum ...)

Like def+int, but for multiple leading definitions.

(examples datum ...)

Like interaction, but with an “Examples:” label prefixed.

(defexamples datum ...)

Like examples, but each definition using define among the datums is typeset without a prompt, and with space after it.

current-int-namespace : parameter?

A parameter to hold the namespace used by interaction, etc.

 

contents

← prev  up  next →