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

How about

  (mac mc args
    `(annotate 'mac (fn ,@args)))
? Then

  arc> (= m (mc (x) `',x))
  #3(tagged mac #<procedure>)
  arc> (m not-a-declared-symbol)
  not-a-declared-symbol
. Of course, the downside here is that, as you observe, we can't do

  arc> (let m (mc (x) `',x) (m not-a-declared-symbol))
  Error: "reference to undefined identifier: _not-a-declared-symbol"
or

  arc> ((mc (x) `',x) not-a-declared-symbol)
  Error: "reference to undefined identifier: _not-a-declared-symbol"
. My understanding is that the problem with the second is that (annotate 'mac ...) is not evaluated before not-a-declared-symbol:

  arc> ((mc (x) `',x) 'not-a-declared-symbol)
  (quote not-a-declared-symbol)
. We get the same output in the other case:

  arc> (let m (mc (x) `',x) (m 'not-a-declared-symbol))
  (quote not-a-declared-symbol)
. However, here I'm not sure why. So after working through this, I'm not actually sure what these results signify. But here they are. Make of them what you will.