<div dir="auto">'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.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 10, 2018, 5:51 AM 清羽 <<a href="mailto:1625143974@qq.com">1625143974@qq.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone, I have a simple question here <div><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> Define a function </span><code class="m_9209426171284460891sourceCode m_9209426171284460891haskell" style="box-sizing:border-box;white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:12.600000381469727px;padding:2px 4px;color:rgb(199,37,78);background-color:rgb(249,242,244);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px">isLower<span class="m_9209426171284460891ot" style="box-sizing:border-box;color:rgb(0,112,32)"> ::</span> <span class="m_9209426171284460891dt" style="box-sizing:border-box;color:rgb(144,32,0)">Char</span> <span class="m_9209426171284460891ot" style="box-sizing:border-box;color:rgb(0,112,32)">-></span> <span class="m_9209426171284460891dt" style="box-sizing:border-box;color:rgb(144,32,0)">Bool</span></code><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif">which returns</span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><code class="m_9209426171284460891sourceCode m_9209426171284460891haskell" style="box-sizing:border-box;white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:12.600000381469727px;padding:2px 4px;color:rgb(199,37,78);background-color:rgb(249,242,244);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px"><span class="m_9209426171284460891dt" style="box-sizing:border-box;color:rgb(144,32,0)">True</span></code><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif">if a given character is a lower case letter. You can use the fact that characters are ordered, and for all lower case letters</span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><em style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif;box-sizing:border-box">ch</em><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif">we have</span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><span class="m_9209426171284460891math m_9209426171284460891inline" style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif;box-sizing:border-box">′<em style="box-sizing:border-box">a</em>′ ≤ <em style="box-sizing:border-box">c</em><em style="box-sizing:border-box">h</em></span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif">and</span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><span class="m_9209426171284460891math m_9209426171284460891inline" style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif;box-sizing:border-box"><em style="box-sizing:border-box">c</em><em style="box-sizing:border-box">h</em> ≤ ′<em style="box-sizing:border-box">z</em>′</span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif">. Alternatively, you can use the fact that</span><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> </span><code class="m_9209426171284460891sourceCode m_9209426171284460891haskell" style="box-sizing:border-box;white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:12.600000381469727px;padding:2px 4px;color:rgb(199,37,78);background-color:rgb(249,242,244);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px">[<span class="m_9209426171284460891ch" style="box-sizing:border-box;color:rgb(64,112,160)">'a'</span><span class="m_9209426171284460891fu" style="box-sizing:border-box;color:rgb(6,40,126)">..</span><span class="m_9209426171284460891ch" style="box-sizing:border-box;color:rgb(64,112,160)">'z'</span>]</code><span style="color:rgb(51,51,51);font-family:-apple-system,'Helvetica Neue',Helvetica,Arial,sans-serif"> evaluates to a list containing all lower case letters.</span></div><div><font color="#333333" face="-apple-system, Helvetica Neue, Helvetica, Arial, sans-serif"> And May I ask what is the meaning of </font>ch <= 'z' and 'a' <= ch? I copied this as a condition and solved the problem.here is my work.</div><div> isLower :: Char -> Bool</div><div> isLower x = if x ch <= 'z' && 'a' <= ch then True else False.</div><div> Thanks in advance.</div><pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'Menlo';font-size:9.0pt"><span style="color:#808080"></span></pre>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>