[Haskell-beginners] May I ask what is the meaning of ch <= 'z' and 'a' <= ch.
fa-ml at ariis.it
Tue Apr 10 13:38:58 UTC 2018
On Tue, Apr 10, 2018 at 08:47:17PM +0800, 清羽 wrote:
> And May I ask what is the meaning of ch <= 'z' and 'a' <= ch? I copied this as a condition and solved the problem.here is my work.
> isLower :: Char -> Bool
> isLower x = if x ch <= 'z' && 'a' <= ch then True else False.
> Thanks in advance.
Hello 清羽, Char is an instance of Ord, so you can use <, compare, etc.
<= and >= stand for "less or equal than" and "greater or equal than".
As with many enumeration types, the order is a bit arbitrary
λ> minBound :: Char
λ> maxBound :: Char
-- so * will be < than, say, A
λ> '*' < 'A'
Does that answer your question?
More information about the Beginners