(Lispex)sicp.io
1.1 · The elements of programming

An expression asks for a value.

Start with combinations. Read the operator first, then the operands, and let evaluation turn the whole form into one value.

Guiding question

What does the evaluator do with a parenthesized combination?

  • Identify the operator and operands in a combination
  • Predict the value before running the program
  • Separate printed output from the returned value

In a combination such as (* 3.14159 (* 5 5)), the first item names the procedure. The remaining items are operand expressions. Lispex evaluates the operands and applies the procedure to their values.

The call to display produces output, but it does not replace the value of the final multiplication. The workbench keeps those two observations separate.

Lispex · SICP sourceScheme-compatible SICP syntax executed by the Lispex SICP profile.
(begin
  (display "area ")
  (* 3.14159 (* 5 5)))
Lispex learning runtimeLispex SICP profile 1.0.0
Loading Lispex SICP runtime
Lispex · SICP source49 / 1,048,576 UTF-8 bytes
Examples
Result
Output
Value
Diagnostic
Visible execution0 / 0 trace events
    This browser result is not a Lispex Vouch record or authority.wasm —
    Expected observation

    The first program prints area and returns 78.53975.

    Trace focus

    Look for the inner multiplication before the outer multiplication. The ordered events expose the nesting that the final number hides.

    Try it yourself

    Change the program before you read the hint.

    Change the radius from 5 to 8. Predict the value, then add a second display call without changing the returned area.

    Show one hint

    In a begin form, the value of the final expression becomes the value of the whole form.