jan tolenaar / kiezellisp / index-of-everything

Name

foreach

Usage

macro

Syntax

(foreach (sym seq) &body forms)

Description

Executes forms repeatedly. Uses loop.

make-html > (foreach (x (series 1 5)) (collecting (+ x x)))
it: (2 4 6 8 10)
make-html > (macroexpand-1 '(foreach (x y) a b c))
it: ((loop (for x :in y) a b c) true)
make-html > (macroexpand '(foreach (x y) a b c))
it: (block LOOP
      (let %range-x (system:get-safe-enumerator y))
      (var x null)
      (block TESTS
        (do
          (if (not (ienumerator:move-next %range-x))
            (leave TESTS))
          (setf x (ienumerator:current %range-x))
          x)
        (block MAIN
          a
          b
          c)
        (redo TESTS)))