<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Question/hint:  You refer to acc three times, all in the right-hand-side expressions. Where is acc defined?</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">-jn-</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 7, 2015 at 2:53 AM, Roelof Wobben <span dir="ltr"><<a 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>
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Beauty of style and harmony and grace and good rhythm depend on simplicity. - Plato</div>
</div>