Re: Elementary but surprisingly difficult.
- From: Bernd Paysan <bernd.paysan@xxxxxx>
- Date: Mon, 26 May 2008 09:25:18 +0200
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/
.
- References:
- Elementary but surprisingly difficult.
- From: Albert van der Horst
- Re: Elementary but surprisingly difficult.
- From: Slava Pestov
- Re: Elementary but surprisingly difficult.
- From: Bernd Paysan
- Re: Elementary but surprisingly difficult.
- From: Albert van der Horst
- Elementary but surprisingly difficult.
- Prev by Date: Re: Elementary but surprisingly difficult.
- Next by Date: Re: Elementary but surprisingly difficult.
- Previous by thread: Re: Elementary but surprisingly difficult.
- Next by thread: Re: Elementary but surprisingly difficult.
- Index(es):
Relevant Pages
|