Arc Forumnew | comments | leaders | submitlogin
2 points by Jesin 6084 days ago | link | parent

Ugh, yes. We need to be careful about these sorts of mistakes. In general, no anaphoric macro calls should appear in the macex1 results for anything but an anaphoric macro.


3 points by Jesin 6083 days ago | link

Here's the definition of each from arc.arc:

  (mac each (var expr . body)
    (w/uniq (gseq g)
      `(let ,gseq ,expr
         (if (alist ,gseq)
              ((afn (,g)
                 (when (acons ,g)
                   (let ,var (car ,g) ,@body)
                   (self (cdr ,g))))
               ,gseq)
             (isa ,gseq 'table)
              (maptable (fn (,g ,var) ,@body)
                        ,gseq)
              (for ,g 0 (- (len ,gseq) 1)
                (let ,var (,gseq ,g) ,@body))))))
This should have been:

  (mac each (var expr . body)
    (w/uniq (gseq g gf)
      `(let ,gseq ,expr
         (if (alist ,gseq)
              ((rfn ,gf (,g)
                 (when (acons ,g)
                   (let ,var (car ,g) ,@body)
                   (,gf (cdr ,g))))
               ,gseq)
             (isa ,gseq 'table)
              (maptable (fn (,g ,var) ,@body)
                        ,gseq)
              (for ,g 0 (- (len ,gseq) 1)
                (let ,var (,gseq ,g) ,@body))))))

-----