Contents    Page-10    Prev    Next    Page+10    Index   

Looping Patterns


((for ?i ?start ?end ?s)

 (PROGN (\:= ?i ?start)
        (LABEL ?j)
        (IF (<= ?i ?end)
            (PROGN ?s
                   (\:= ?i (+ 1 ?i))
                   (GOTO ?j) )))

 t ((?j (gentemp "LABEL"))) )

((while ?c ?s)

 (PROGN (LABEL ?j)
        (IF ?c (PROGN ?s (GOTO ?j))))

 t ((?j (gentemp "LABEL"))) )

((repeat-until ?c . ?s)

 (PROGN (LABEL ?j)
        (progn . ?s)
        (IF ?c (PROGN) (GOTO ?j)))
 t ((?j (gentemp "LABEL"))) )