> From: Dan Bron
> 
> Here's a recent example.  I'm trying to code the "evoluationary
> algorithm"
> from RC  http://rosettacode.org/wiki/Evolutionary_algorithm  .  The
> code I
> have so far reads [1]:
> 
>       CHARS     =: ' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>       randomize =: fivePct`mutation}
>       fivePct   =: 0.05 >: $ ?...@$  0:
>       mutation  =: (UCALPHA,' ')&(] ,: [ {~ $...@] ?...@$ #...@[)
>       score     =: +/@:~:"1
>       copy100   =: 100 $ ,:
>       done      =: 1 - -:
>       initial   =: CHARS ([ {~ ?...@$&#~ ) [
> 
>         f         =:  ([ (] {~ (i. <./)@:score) randomize@:copy100@:])
> 
>       (f^:done^:_: initial) 'METHINKS IT IS LIKE A WEASEL'
> 

Hi Dan, 
I'm just catching up on the forum (having been on holiday for a while). 
While not related to your main query (which others appear to have handled), I 
thought I should note that I've submitted a solution for that problem on 
Rosetta Code. I was aware of this thread, but hadn't read your code beforehand, 
nevertheless that there are a number of similarities. I'm sure some of your 
ideas above could be used to improve my current implementation. A tacit version 
of the current "mutate" verb would be nice.

A tacit version of the while loop would also be good but I think it should be 
included in addition to the explicit one.

I'm starting to see Rosetta Code not only as a Rosetta stone for different 
languages but also for the different forms (tacit/explicit) of J!

Ric

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to