Re: Elementary but surprisingly difficult.
- From: Bruce McFarling <agila61@xxxxxxxxxxxx>
- Date: Sat, 24 May 2008 16:24:38 -0700 (PDT)
On May 24, 6:23 pm, Slava Pestov <sl...@xxxxxxxxx> wrote:
On May 24, 4:36 pm, Bernd Paysan <bernd.pay...@xxxxxx> 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 - ;
This is why stack-based languages have a reputation of unreadability.
``uniquify'' ... I dunno, that word looks pretty readable to me.
Its *definition* is underfactored, of course, and underfactored
definitions are always hard to read, but
uniquify ( addr u -- addr u' )
trim duplicate characters from a sorted string, in place
.... seems pretty readable to me.
.
- Follow-Ups:
- Re: Elementary but surprisingly difficult.
- From: John Passaniti
- Re: Elementary but surprisingly difficult.
- From: vandys
- Re: Elementary but surprisingly difficult.
- 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: Slava Pestov
- 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
|