[Haskell-beginners] May I ask what is the meaning of ch <= 'z' and 'a' <= ch.

清羽 1625143974 at qq.com
Tue Apr 10 12:47:17 UTC 2018


Hello everyone, I have a simple question here     Define a function isLower :: Char -> Bool which returns True if a given character is a lower case letter. You can use the fact that characters are ordered, and for all lower case letters ch we have ′a′ ≤ ch and ch ≤ ′z′. Alternatively, you can use the fact that ['a'..'z'] evaluates to a list containing all lower case letters.
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180410/c7dcbc1e/attachment.html>


More information about the Beginners mailing list