Arc Forumnew | comments | leaders | submitlogin
alternate 'on with user-specified index
1 point by bd 6124 days ago | discuss
The 'on macro has a hard-coded 'index variable. What do you think about this alternative that mimics the argument list of 'ontable by specifying an index variable? With type checking, a single 'on macro could handle sequences and tables.

  (mac on2 (idx var s . body)
   (w/uniq gs
     `(let ,gs ,s
        (forlen ,idx ,gs
          (let ,var (,gs ,idx)
            ,@body)))))