Re: Elementary but surprisingly difficult.



Albert van der Horst wrote:
: uniquify ( addr u -- addr u' )
over >r bounds dup dup c@ 2swap 1+ ?DO
I c@ tuck <> IF swap 1+ 2dup c! swap THEN LOOP
drop r> swap over - ;

AAP 10 uniquify .

[gives 4]

Yes, that's a off-by-one bug, add 1+ at the end of uniquify.

--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/
.



Relevant Pages