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


Groups > comp.lang.forth > #20470 > unrolled thread

Word-Mungler

Started by"WJ" <w_a_x_man@yahoo.com>
First post2013-03-08 20:21 +0000
Last post2013-03-08 23:53 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.forth


Contents

  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

#20470 — Word-Mungler

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-08 20:21 +0000
SubjectWord-Mungler
Message-ID<khdh8s$268$1@dont-email.me>
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
;

: mungle ( str -- str )
  R/ [a-zA-Z]+|[^a-zA-Z]+/ all-matching-subseqs
  [ mungle-word ]
  map
  "" join
;

"They are not interested in using or making a good language.
Their only desire is to worship the apes who wrote
the 'Forth standard'."
mungle print


They are not irtenteesd in unsig or mikang a good lguaange.
Thier only derise is to woshirp the aeps who wtroe
the 'Ftroh santdard'.

[toc] | [next] | [standalone]


#20471

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-08 23:39 +0000
Message-ID<khdsrf0uoj@enews1.newsguy.com>
In reply to#20470
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
;

[toc] | [prev] | [next] | [standalone]


#20472

FromZbiggy <zbigniew2011REMOVE@gmail.REMOVE.com>
Date2013-03-08 23:53 +0000
Message-ID<slrnkjl1m2.98t.zbigniew2011REMOVE@Tichy.myhome.org>
In reply to#20471
In comp.lang.forth, WJ wrote:

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

comp.lang.forth comp.lang.factor 560 CMOVE>

-- 
The consensus was, as usual in this community, that there is no consensus. (RA)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web