<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 6, 2015 at 10:18 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"><div id=":1ct" class="a3s" style="overflow:hidden">Can someone give me a tip how to solve this<br>
I have asked this on the beginners ML but the only answer I get was someone who was using some if -then statement and I think I can be solved without.<br></div></blockquote></div><br>You need to distinguish three "zero" cases:</div><div class="gmail_extra"><br></div><div class="gmail_extra">- the value is itself zero</div><div class="gmail_extra">- leading zero (i.e. you hit the end of available digits)</div><div class="gmail_extra">- interior zero</div><div class="gmail_extra"><br></div><div class="gmail_extra">The middle one is your end case --- but this will give you no output if the value you put in initially is zero, since you're already at the end case. So you need to treat an initial value of 0 specially somehow to get output for it. So, either an explicit conditional or a setup where the public function handles an explicit zero and otherwise defers to what you have, which becomes an internal/hidden function (via where or let).<br><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</div></div>