Comparison: Difference between revisions
Content added Content deleted
m (Lowercase title) |
("Remove lowercase again - it is in the template now") Tag: Manual revert |
||
Line 1: | Line 1: | ||
{{lowercase title}} |
|||
{{primitive|x<y<br>x>y<br>x=y}} |
{{primitive|x<y<br>x>y<br>x=y}} |
||
Revision as of 01:29, 9 July 2022
Comparison
x<y
x>y
x=y
x>y
x=y
The comparison primitives in K are <
, >
and =
which stand for lesser than, greater than and equal to respectively. Comparisons are fully atomic.
Characters are compared as bytes, except in oK which supports Unicode and compares characters by their code points.
The comparison functions always give a boolean value, 1 or 0.
1 2 3 < 3 1 5 1 0 1 "abc" > "!c " 1 0 1 2 56 1 = (2;4;"a") 1 0 0