Pancode - Commands - Comparisons

The comparison commands compare values for equality or inequality using the standard ordering rules. These commands make extensive use of both scalar and transitive extension

In some cases, it is desirable to compare two values which may or may not be lists and scalar extension is undesirable. In this case, wrap both arguments in a box () before calling the comparison. To put the top two arguments in a box, the following snippet may be used.

Comparing two lazy lists may hang, if both are infinite and the comparison cannot be determined from a finite prefix.

`⊂↘

Equal (=)

Determines whether the two arguments are equal. Subject to scalar and transitive extension.

Less Than (<)

Determines whether the first argument is less than the second. Subject to scalar and transitive extension.

Greater Than (>)

Determines whether the first argument is greater than the second. Subject to scalar and transitive extension.

Less Than or Equal ()

Determines whether the first argument is less than or equal to the second. Subject to scalar and transitive extension.

Greater Than or Equal ()

Determines whether the first argument is greater than or equal to the second. Subject to scalar and transitive extension.

Not Equal ()

Checks whether the two arguments are not equal. Subject to scalar and transitive extension.

Same ()

Checks whether the two arguments are equal. Subject to transitive extension. This behaves identically to = but does not perform scalar extension.

Not Same ()

Checks whether the two arguments are not equal. Subject to transitive extension. This behaves identically to but does not perform scalar extension.

Tri-State Comparison (🧭)

Compares the two arguments and returns -1 if the former is less, 1 if the latter is less, and 0 if the two are equal. If the values are non-comparable, raises an error. Subject to scalar extension but not transitive extension.

Max ()

Takes two arguments and returns whichever is larger. Subject to scalar and binary extension. If used with a prime modifier, this command first pops a function, which is used instead of the standard < for comparison. If given a numerical modifier of zero, this command pushes -∞.

Min ()

Takes two arguments and returns whichever is smaller. Subject to scalar and binary extension. If used with a prime modifier, this command first pops a function, which is used instead of the standard < for comparison. If given a numerical modifier of zero, this command pushes .

Documentation Index