Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 5548 days ago | link | parent

Happy to help.

Oh, yes, quoted-unquotes are done pretty often.

  $ grep -c "'," {arc,code,html,srv,app,news}.arc
  arc.arc:17
  code.arc:1
  html.arc:6
  srv.arc:9
  app.arc:1
  news.arc:7
For example, the Arc built-in obj is a macro that makes a hash table with automatically-quoted keys.

  arc> (= h (obj a 1 b 2))
  #hash((b . 2) (a . 1))
  arc> (h 'a)
  1
  arc> (h 'b)
  2
It's defined like so:

  (mac obj args
    `(listtab (list ,@(map (fn ((k v))
                             `(list ',k ,v)) ; note we unquote k, then quote it
                                             ; so we're quoting the value of k
                           (pair args)))))
That way, the above (obj a 1 b 2) expands into

  (listtab (list (list 'a 1) (list 'b 2)))


1 point by evanrmurphy 5548 days ago | link

Thanks again.

-----

1 point by thaddeus 5548 days ago | link

dito

-----