Arc Forumnew | comments | leaders | submitlogin
1 point by skenney26 5617 days ago | link | parent

Another twist is to use the 'on interator which binds its first argument to each successive element and implicitly binds 'index to the index of that element.

  arc> (on c "arc" (prn index ":" c))
  0:a
  1:r
  2:c
  nil

  (def ugh (str)
    (let x 5
      (on c str
        (let v (trunc (/ 12 (+ index 1)))
          (if (is c #\A)
              (++ x v)
              (-- x v))))
      x))


1 point by drcode 5616 days ago | link

ah... I should be using 'on more often....

-----