<br><br>
<div class="gmail_quote">2009/3/12 7stud <span dir="ltr"><<a href="mailto:bbxx789_05ss@yahoo.com">bbxx789_05ss@yahoo.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im">7stud <bbxx789_05ss <at> <a href="http://yahoo.com/" target="_blank">yahoo.com</a>> writes:<br>><br>> Why does<br>><br>> take (0 - 1) [1, 2, 3]<br>><br>> produce a result but not<br>
><br>> take -1 [1, 2, 3]<br>><br>> ? Thanks<br>><br><br></div>Well, immediately after I hit the submit button, I thought I'd try this:<br>
<div class="im"><br>*Main> take (-1) [1, 2, 3]<br></div>[]<br><br>So why are the parentheses needed there?<br>
<div>
<div></div>
<div class="h5"><br> </div></div></blockquote>
<div> </div>
<div>I think because take -1 [1,2,3] is parsed as (take - 1 ) [1,2,3] or something like that.</div>
<div>If you look to the error message, and translate the haskellese in plain english, it says so. </div>
<div> </div>
<div>"In the second argument of `(-)', namely `1 [1, 2, 3]' " : </div>
<div>so it looks like is looking for the two arguments of infix operator (-), the first being 'take'.</div>
<div>But I don't understand because it says that 1 [1,2,3] is a single argument...<br></div>
<div>"In the definition of `it': it = take - 1 [1, 2, 3]"<br>notice the blank between the minus sign and 1: even if you write -1, it understands - 1.</div>
<div> </div>
<div>So, ghc is trying to be helpful here :-)</div>
<div> </div>
<div>Ciao</div>
<div>-----</div>
<div>FB</div></div>