Alex wrote : >To make it faster, it *should* be serialized, so that it isn't actually >recursive; that should be quite easy (but will make the code much less > easy to read or understand, so I haven't done it yet). If you think it's > worth pursuing, let me know and I'll have a go at unrolling the recursiveness.
Recursive scripts is something I know in principle about, but never have used them before. They are quite compact, but I find it hard to follow, especially as your variables are emptied in each new entry into the script (f.i. t3 in Alex's script). I tried to unroll it and make it serial, but I am having troubles with it. I think I should start in the opposite direction and work back, but it's too late now for me to solve it. First a little sleep. I also tried to serialise Geoff's script, but am running into the same difficulty. I haven't grasped the concept completely I guess. If you could give me a hint, Alex, I'd be happy. As for the Duplicates : Alex wrote : > permut() is the optimized version - optimize simepl cases of 1 or 2 chars, > eliminate duplicates as we go. Well, it does so, but not completely. First, as I discovered in my own script with eliminating duplicates, it needs the input in the form of the most duplicates in the beginning and then trailing off. F.i. 111223 would work , but 112223 or 112333 would not return all of the possible (non duplicate) permutations. Moreover, in the script of Alex, a couple of duplicates slip thru. F.I. 1123 gives 14 permutations i.s.o. 12. In the list below, the # are the doubles. 1123 1132 1213 1231 1312 1321 2113 2131 2311 # 2311 # 3112 3121 3211 # 3211 # An advantage of Alex's script and also my own over other scripts is, that these scripts give a better ordaining of the permutations as a result. In a more systematic way, due to the fact how they are constructed of course. Thanks for all your input, I really appreciate, Cheers, 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