Documentation for term term:<>
assembled from the following pages:
Language documentation: Syntax §
From Syntax
(Syntax) term term:<> §
You can use term:<>
to introduce new terms, which is handy for introducing constants that defy the rules of normal identifiers:
use Test; plan 1; constant :<👍> = .assuming(True);👍# OUTPUT: «1..1ok 1 - »
But terms don't have to be constant: you can also use them for functions that don't take any arguments, and force the parser to expect an operator after them. For instance:
sub term:<dice> ;say dice + dice;
can print any number between 2 and 12.
If instead we had declared dice
as a regular
sub dice()
, the expression dice + dice
would be parsed as dice(+(dice()))
, resulting in an error since sub dice
expects zero arguments.