Contents    Page-10    Prev    Next    Page+10    Index   

Code Expansion by Looping Patterns


>(trans '(for i 1 100
           (\:= sum (+ sum (aref x (* 8 i)))))
        'loops)

(PROGN
  (|:=| I 1)
  (LABEL LABEL7)
  (IF (<= I 100)
      (PROGN
        (|:=| SUM (+ SUM (AREF X (* 8 I))))
        (|:=| I (+ 1 I))
        (GOTO LABEL7))))

>(trans '(repeat-until (> i 100)
           (writeln i) (\:= i (+ i 1)))
        'loops)

(PROGN
  (LABEL LABEL8)
  (PROGN (WRITELN I) (|:=| I (+ I 1)))
  (IF (> I 100) (PROGN) (GOTO LABEL8)))