<div dir="ltr">Gah, got here late and missed that this was a response, not the problem description. That's twice now I've put my foot in it. Stupid mailinglists, with no edit buttons...<div><br></div><div>Well at least in both cases I've added SOMETHING useful. :)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 14, 2015 at 11:42 PM, Theodore Lief Gannon <span dir="ltr"><<a href="mailto:tanuki@gmail.com" target="_blank">tanuki@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">GHCi doesn't quite support everything you could put in a source file. To do what you want here, you need to use Haskell's alternative block syntax:<span class=""><div><br></div><div><span style="font-size:12.8px">:{</span><br style="font-size:12.8px"><span style="font-size:12.8px">let { </span><span style="font-size:12.8px">digs 0 = [0]</span></div><div><span style="font-size:12.8px"> ; digs x = (digs (x `div` 10)) ++ [(x `rem` 10)]</span></div><div><span style="font-size:12.8px"> }</span><br style="font-size:12.8px"><span style="font-size:12.8px">:}</span><br></div><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">...yep, curly braces and semicolons just like C-family. :) It's intended for machine-generated code, but works for this too. And in fact you actually don't need multi-line, this is legal:</span></div><span class=""><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">let { digs 0 = [0]; digs x = </span><span style="font-size:12.8px">(digs (x `div` 10)) ++ [(x `rem` 10)] }</span></div><div><span style="font-size:12.8px"><br></span></div></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 14, 2015 at 9:35 PM, <span dir="ltr"><<a href="mailto:amindfv@gmail.com" target="_blank">amindfv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In ghci you want to make a multi-line expression:<br>
<br>
:{<br>
let digs 0 =[0]<br>
digs x = (digs (x `div` 10)) ++ [(x `rem` 10)]<br>
:}<br>
<br>
(Note we don't put "let" on the second line)<br>
<br>
tom<br>
<br>
<br>
> El 13 nov 2015, a las 01:47, akash g <<a href="mailto:akaberto@gmail.com" target="_blank">akaberto@gmail.com</a>> escribió:<br>
><br>
> let digs 0 =[0]<br>
> let digs x = (digs (x `div` 10)) ++ [(x `rem` 10)]<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>