Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do LT and GT mean?

Tags:

haskell

GHCi> compare 2 3
LT
GHCi> compare 3 3
EQ
GHCi> compare 4 3
GT

I think EQ means equal, but what do LT and GT mean?

like image 944
XIA Yang Avatar asked Mar 17 '12 10:03

XIA Yang


2 Answers

  • compare 2 3 = LT — 2 is Less Than 3
  • compare 3 3 = EQ — 3 is EQual to 3
  • compare 4 3 = GT — 4 is Greater Than 3

It's unfortunate that the documentation for Ordering does not explicitly spell this out.

like image 134
dave4420 Avatar answered Sep 20 '22 13:09

dave4420


It's not in haskell only, GT and LT are very common and well known acronyms respectively for Greater Than and Less Than. Other common acronyms for comparisons include GE and LE, i.e. Greater or Equal and Less or Equal, but they are not part of the Haskell's Ordering data constructors. You are right about EQ = "equal".

like image 30
Riccardo T. Avatar answered Sep 19 '22 13:09

Riccardo T.