<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
The problem is that you define digs twice and the second definition
overshadows the first one. This makes your recursion infinite.<br>
<br>
You should define all cases at once like:<br>
<tt><br>
</tt><tt>let digs 0 = [0]; digs x = (digs (x `div` 10)) ++ [(x `rem`
10)]
<br>
</tt><br>
Greg<tt><br>
</tt><br>
<div class="moz-cite-prefix">On 13.11.2015 07:36, Abhishek Kumar
wrote:<br>
</div>
<blockquote
cite="mid:CAEAgXqWUX+BwnxsF+ugGnLEZBZ9+w4njFV1L9ch8qzqcQDuqcw@mail.gmail.com"
type="cite">
<pre wrap="">Bellow is my code for returning a list of digits given an integer.I'm
unable to find any bug in it but somehow it crashes any computer I run it
on when I try to calculate digs 100.Please tell me bug in my code.
let digs 0 =[0]
let digs x = (digs (x `div` 10)) ++ [(x `rem` 10)]
digs 100
Thanks
Abhishek
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>