1 \section[Dollar extension
]{{\tt dollar
}: generic syntax for macros
}
2 When you write a short-lived macro which takes reasonably short arguments, you
3 generally don't want to write a supporting syntax for it. The dollar library
4 allows you to call it in a generic way: if you store your macro in the table
5 {\tt mlp.macros
}, say as function
{\tt mlp.macros.foobar
}, then you can call it
6 in your code as
{\tt\$foobar(arg1, arg2...)
}: it will receive as parameters the
7 ASTs of the pseudo-call's arguments.
13 function doller.LOG(id)
14 match id with `Id
{ id_name
} ->
15 return +
{ printf("
%s = %s", id_name,
16 table.tostring(-
{id
}))
}
21 $LOG(x) -- prints "x =
{ 1,
2,
3 }" when executed