Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #20471

Re: Word-Mungler

From "WJ" <w_a_x_man@yahoo.com>
Newsgroups comp.lang.forth
Subject Re: Word-Mungler
Date 2013-03-08 23:39 +0000
Organization NewsGuy - Unlimited Usenet $19.95
Message-ID <khdsrf0uoj@enews1.newsguy.com> (permalink)
References <khdh8s$268$1@dont-email.me>

Show all headers | View raw


WJ wrote:

> Shuffle the interior letters of each word.
> 
> USING: locals random regexp ;
> 
> :: mungle-word ( str -- str )
>   str R/ [a-zA-Z]+/ matches?
>   str length 3 >  and
>   [ str rest-slice but-last-slice randomize drop ]
>   when
>   str
> ;

USING: locals random ascii regexp ;

:: mungle-word ( str -- str )
  str first letter?
  str length 3 >  and
  [ str rest-slice but-last-slice randomize drop ]
  when
  str
;

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Word-Mungler "WJ" <w_a_x_man@yahoo.com> - 2013-03-08 20:21 +0000
  Re: Word-Mungler "WJ" <w_a_x_man@yahoo.com> - 2013-03-08 23:39 +0000
    Re: Word-Mungler Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-08 23:53 +0000

csiph-web