Arc Forumnew | comments | leaders | submitlogin
2 points by absz 6124 days ago | link | parent

Try removing the comma in front of olddef; it should work then.


4 points by Darmani 6124 days ago | link

Unfortunately, that won't work because the form is being returned to a place outside the closure where olddef was defined; when eval is given the form containing olddef, it will not recognize it.

Here's a better definition:

  (let olddef def
    (mac def (name args . body)
      (if (acons name)
        `(def= ,(cadr name) ,args ,@body)
        (apply (rep olddef) (cons name (cons args body))))))

-----

2 points by absz 6124 days ago | link

Shouldn't that be (mac def ...)?

Anyway, nice work, but damn do we need 1st-class macros.

-----

3 points by Darmani 6124 days ago | link

Oops -- thank you. Fixed.

-----