In Lisp, there is so-called backquote-comma-notation for defining macros.
ATS borrowed it.
macdef foo(x) = ,(x) + ,(x) // short form
is shorthand fo
macrodef foo(x) = `(,(x) + ,(x)) // long form
(...) means to treat whatever inside literally; ,(...) cancels the effect of (…). Search for backquote-comma-notation,
and you should find plenty explanation.On Sat, May 9, 2015 at 10:20 PM, ‘Yannick Duchêne’ via ats-lang-users < ats-lan...@googlegroups.com> wrote:
Le vendredi 11 avril 2014 22:02:59 UTC+2, gmhwxi a écrit :
ATS has a fairly sophisticated macro system, which, unfortunately, has
barely been
documented.
Please, how to understand the commas in these definitions? Why are there
commas which seems to separate blanks? Also, what is the reasons of the
seemingly unnecessary parentheses around what looks to be atomic
expressions? Is this for the same reason as with C defines, which is to
avoid issue in case the expression is composed with operators which could
cause precedence issues?
Please, how to understand the commas in these definitions? Why are there
commas which seems to separate blanks? Also, what is the reasons of the
seemingly unnecessary parentheses around what looks to be atomic
expressions? Is this for the same reason as with C defines, which is to
avoid issue in case the expression is composed with operators which could
cause precedence issues?