programdemos/macros.xtl
Macros write source for you: a call "left" n_ame< "right" is replaced, before the program is checked, by the source the macro writes from the two texts. Run it with ./demos/macros.xtl (or xetal run): it prints what the system macros give, then a macro library's checks; a failed a_ssert< goes to standard error. Read each call beside its expansion, which "xetal expand demos/macros.xtl" shows.
System macros
x : Int
x ← -3
ᵘm̲ax/ : Num a => a -> a
u:m_ax/ v, u:m_in/ v: the largest and smallest item of v, written by e_ach<, one statement per word with $w replaced by the word.
"m_ax m_in" e̲ach< "u:$w/ := { '$w r_/ _r }"
Used in: demos/macros.xtl:23
ᵘm̲in/ : Num a => a -> a
u:m_ax/ v, u:m_in/ v: the largest and smallest item of v, written by e_ach<, one statement per word with $w replaced by the word.
"m_ax m_in" e̲ach< "u:$w/ := { '$w r_/ _r }"
Used in: demos/macros.xtl:24
Macros of your own
ᵘs̲quare : Num a => a -> a
u:s_quare x: x times x, defined by the m:d_ef< macro.
"s_quare" ᵐd̲ef< "_r * _r"
Used in: demos/macros.xtl:39