Am Samstag 06 März 2010 20:32:29 schrieb Terrence Brannon:
> : log2 ( +n1 -- n2 )
>
> assert( dup 0> )
> halve-n
> init-counter-for-number-of-halves-needed
> BEGIN
> insure-n-is-greater-than-or-equal-to-0
> WHILE \ n >= 0
> halve-n-and-increment-counter { n counter -- n/2 counter+1 }Change these braces to parentheses, then it will work. What you are doing here is declaring and initializing two local variables, which consume two values on the stack. > REPEAT > NIP \ n, leaving the counter > ; -- Bernd Paysan "If you want it done right, you have to do it yourself" http://www.jwdt.com/~paysan/
signature.asc
Description: This is a digitally signed message part.
