Rules / Operators / tight or

minmax Skeleton

infix minmax

minmax
infixtight or 17/27list-assocRaku++ runs this — 1 of 7 results differdocs.raku.org ↗

The rules for minmax have not been written yet. Everything below is extracted rather than authored: the official documentation supplies the classification, and the interpreters were asked directly about the rest.

What is established #

Classification #

minmax is parsed as an infix at the tight or precedence level, list-associative.

That is level 17 of 27 on the ladder, counting from the tightest. Operators sharing a level bind equally; grouping among them is decided by associativity alone.

Shares its precedence level with #

||, ^^, //, min, max.

These all bind equally tightly, so an expression mixing them groups by associativity alone.

What the interpreter said #

Raku++ parses this spelling. Asked to compile:

my $a = 6; my $b = 3; sink($a minmax $b)

…it got through the parser. On its own that establishes very little: it says nothing about whether the construct executes, let alone whether the result is right. Where the behaviour table below exists, that is the stronger evidence — those expressions were actually run.

Covered upstream #

The official documentation has a section for this construct: docs.raku.org. Until the rules here are written, that is the better reference.

Observed behaviour #

Each expression below was executed by both interpreters when this page was built; the results are recorded, not written. The operands are chosen to cross the boundaries that catch people out: string against number, a list where a scalar was meant, a boolean, an undefined value, and an exact rational.

1 of 7 of these disagree between Raku++ and Rakudo — shown side by side below. A disagreement here is a defect report waiting to be written, not a documented rule.

ExpressionRaku++Rakudo
1 minmax 2Range | 1..2
"a" minmax "b"Range | "a".."b"
1 minmax "2"Range | 1..2
(1, 2) minmax (3, 4, 5)Range | 1..5
True minmax FalseRange | Bool::False..Bool::True
Nil minmax 1ERR No such method 'Nil' for invocant of type 'Range'Range | 1..1
1/2 minmax 1/3Range | <1/3>..0.5