[Haskell-beginners] May I ask what is the meaning of ch <= 'z' and 'a' <= ch.
Theodore Lief Gannon
tanuki at gmail.com
Tue Apr 10 17:51:17 UTC 2018
'ch' here is a variable, standing for 'character.' It takes the place of
'x'. Your solution is almost correct, you just need to pick one name or the
other for your variable.
On Tue, Apr 10, 2018, 5:51 AM 清羽 <1625143974 at qq.com> wrote:
> 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*′
> ≤ *c**h* and *c**h* ≤ ′*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.
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners