Now for the permutations.

Geoff, great. Your script is by far the fastest. Almost 10 times faster than my 
own script which comes second.
I could improve a little bit even on your script with the suggestion of Kay.

--
Kay wrote :

I obtained a 10% speed increase by changing this:

 repeat with n = 3 to 10

to this:

    put "3,4,5,6,7,8,9,10" into nList
    repeat for each item n in nList
--

Geoff, you mentioned that I would not be to hard to expand the script beyond 10 
elements. I been trying, but no dice yet. Any pointers?

I also tried to implement a fast way to permutate elements which contain 
duplicates (like 00112)
This would give only 30 distinct permutations i.s.o. 120. Of course, I could 
run the script and replace all the 1s with 0s, all the 2's with 1's, etc. and 
then delete the duplicates.
But if I could delete duplicates much earlier on, it would be much faster.
I think I know where to delete the duplicates in the script, but cannot get yet 
your script running by inputting a list like "0,0,1,1,2" ( or 00112 ) and use 
the trick Kay suggested.
It works if I rework N to a  list like  "01234". I will sleep over it :-)

Thanks a lot Geoff,

Beat
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to