<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">I did solve it at this way <br>
I had my causes all wrong<br>
<br>
-- | sum all the digits of a array <br>
sumDigits :: [Integer] -> Integer<br>
sumDigits n <br>
| n == 0 = acc<br>
| n < 10 = acc + n <br>
| otherwise = sumDigits acc + n `mod` 10 + n `rem` 10 <br>
<br>
<br>
Roelof<br>
<br>
<br>
<br>
<br>
yi lu schreef op 7-2-2015 om 10:01:<br>
</div>
<blockquote
cite="mid:CAKcmqqyMAnsv8sORoDk_JzD=DZMuORC-eyPan4joYwqZsNMZiA@mail.gmail.com"
type="cite">
<div dir="ltr">Do not try to `sum` all at first. See how you can
deal with one integer.<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Feb 7, 2015 at 4:53 PM, Roelof
Wobben <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
The exercises of CIS 194 are really hard.<br>
<br>
Now I have to sum all the numbers in a array with a catch<br>
If a number is greater then 10 it has to be dived in single
numbers.<br>
<br>
so [ 1 , 12, 3] will be [ 1, 1,2,3] and then sum up.<br>
<br>
So far I have this :<br>
<br>
-- | sum all the digits of a array<br>
sumDigits :: [Integer] -> Integer<br>
sumDigits n<br>
| n == 0 = acc<br>
| n < 10 = acc + n<br>
| otherwise = sumDigits acc + n `mod` 10 + n `rem` 10<br>
<br>
<br>
But now I see a message that acc is not known which is not
wierd.<br>
<br>
But when I do sumDigits n acc I see a message that sumDigits
has only 1 parameter where I give it to,<br>
<br>
When I only had to sum up i is easy , I could use map [+] xs<br>
<br>
Anyone who can give a me tip without giving the answer
otherwise I do not learn anything.<br>
<br>
Roelof<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a moz-do-not-send="true"
href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a moz-do-not-send="true"
href="http://www.haskell.org/mailman/listinfo/beginners"
target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote>
</div>
<br>
</div>
<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://www.haskell.org/mailman/listinfo/beginners">http://www.haskell.org/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>