Arc Forumnew | comments | leaders | submitlogin
5 points by projectileboy 6126 days ago | link | parent

Enormously helpful. Thank you. Coming from Blub world, it's been hard for me to think functionally - making a distinction between returning values and side effects.

I don't understand your first point however, as this is a perfectly valid macro:

(mac double (x) `(+ ,x ,x))



8 points by ryantmulligan 6126 days ago | link

Let me explain the "two within one" problem that you may be saying that you do not see.

  (mac check args                                 ;;no qq's
       `(do                                       ;; ` one qq
          ,(each arg (list ,@args)                ;; ,(,@) two escapes
             `(report-result ,arg ',arg))))       ;; `(, ',) two qq one escape
So on the line

  ,(each arg (list ,@args) 
you are doubly escaping something that is only quoted once.

-----

0 points by projectileboy 6126 days ago | link

Gotcha. Gracias.

-----

3 points by almkglor 6126 days ago | link

Nitpick. This is not a good definition (valid, but not good). The problem is something like this:

  (double (prn 3))
Try the above in your repl after entering the mac definition; then consider what must be done in order to protect the x. For example, you might notice that the macros in arc.arc have a lot of (w/uniq (...) `(let ...)) forms, even the arguably simpler ones.

-----