lua-users home
lua-l archive

Lexciographical comparison of tuples

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I have an application with lots of tuples of non-negative integers, on
which I need to do lexicographical comparisons. I've discovered that
string comparison works if you format the tuples as comma-separated
lists inside parentheses, e.g. "(1,5)"<"(10,5)" and "(0,0)"<"(0,0,0)".
The reason is that parentheses compare less than comma, and comma less
than a digit, even in EBCDIC.

AltStyle によって変換されたページ (->オリジナル) /