programdemos/higher-order.xtl
Higher-order built-ins: they take quoted functions as operands, as
'+ r̲/ v reduces v with plus. Run it with
"xetal run demos/higher-order.xtl" (or "./demos/higher-order.xtl");
it prints the result of each line: reductions, a scan, an outer and
an inner product, e_ach, c_ompose and s_wap, then the search and
order built-ins s_ort, g_rade, u_nique, i_ndexOf and w_here.
Reduce and scan
Matrices: reduce, outer and inner products
Functions as operands
ᵘs̲ign : (Num a, Num b) => a -> b
u:s_ign x: -1 when x is negative, 0 when it is zero, 1 otherwise.
ᵘs̲ign ← { x → x < 0 ? -1◆ x = 0 ? 0◆ 1 }
Used in: demos/higher-order.xtl:29