Special Form Entry: FOREACH

← Prev | ↑ Chapter | Next → | Index | Symbols

Special Form Entry: FOREACH

Name

foreach

Class

Special Form

Syntax

(foreach name list [expr ...])

Description

Iterates over each element of list, binding it to name.

Evaluation Rules

  • evaluate list
  • for each element of the resulting list, bind it to name
  • evaluate the body forms in order

Return Values

Returns the final body value or nil if no body exists.

Side Effects

Side effects are those of:

  • evaluation of list,
  • rebinding name for each iteration,
  • evaluation of the body forms for each iteration.

Exceptional Situations

Erroneous if the list argument is not acceptable to the active host semantics.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: presumed compatible (no contradicting page found).
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.

Source Notes