<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, May 10, 2014 at 8:22 AM, Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is it valid Haskell if I change the putStrln to putStrln ( show n * n) so I do not have to use the let command.<br></blockquote><div><br></div><div>You would need to write <font face="courier new, monospace">putStrLn (show (n * n))</font><font face="arial, helvetica, sans-serif"> in order for it to parse the way you intend. Function application is left-associative.</font> You could also use <font face="courier new, monospace">print</font><font face="arial, helvetica, sans-serif"> instead of </font><font face="courier new, monospace">putStrLn</font><font face="arial, helvetica, sans-serif">, which is shorthand for this.</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another question if I change return n with return () does the loop ever end. My feeling says not because the value of n is never updated for the loop.</blockquote><div><br></div><div>Yes, the loop would terminate. The <font face="courier new, monospace">return n</font> in your code is not updating <font face="courier new, monospace">n</font><font face="arial, helvetica, sans-serif">. The next iteration of the loop receives a new value of </font><font face="courier new, monospace">n</font><font face="arial, helvetica, sans-serif"> as its argument due to your passing it in with </font><font face="courier new, monospace">loop (n + 1)</font><font face="arial, helvetica, sans-serif">.</font></div>
</div></div></div>