Hallvard, what a curious problem? Why? I think the way to go is using the sort comparator function as I showed before. The two elements to be compared at each step are put into the arguments, here, 'a and 'b.
sort/compare blk func [a b][either a/4/3 = #"c" [1][-1]] This moves blocks with the third character of the string equalling character #"c" nextward, and others backward. So after that you are guaranteed all the "c" elements are at the end. Next, I think you should write a loop, that redistributes these "c" blocks amongst the others as best it can. So the final result might look like [c n c n c n c n n n n ...] (Where c = "c"-blocks, and n = non-"c" blocks) You might be able to do all this in the sort comparator function somehow, but it's not obvious to me. How much does speed matter? Anton. > Dixit Joel Neely (03.06 04.01.2004): > >How about this: > > > > >> random [0 1 2 3 4 5 6 7 8 9] > > == [8 9 3 4 2 1 7 6 0 5] > > Ah, of course. I didn't think about the fact that 'random takes > anything as an argument... > > >Can you provide a little more detail on your requirements? > > Yes. Especially since I have nested blocks. I have a block with, > say 10 blocks inside it. Each block has many different data types > within it (but only one element matters). I want to unsort them > so that _part of_ the fourth element (a string) is not identical > in adjacent blocks. So this is what I want to avoid (not real example): > > example: [[4 1 7 "nicsrg" 5 6 3 8 2 9] [3 1 2 "sicrtg" 9 8 4 7 6 > 5] [9 3 7 "iscgtn" 6 2 8 5 4 1] [1 3 8 "inctrg" 5 2 9 4 6 7] [9 6 > 5 "ngsirt" 8 2 1 3 7 4] [3 7 8 "igtnrs" 4 1 2 9 5 6] [6 4 8 > "gnrsit" 2 3 9 1 5 7] [9 5 4 "sntgir" 6 7 8 2 1 3] [6 7 4 > "gstinr" 1 5 2 3 9 8] [7 9 2 "sgcnit" 5 1 8 3 6 4]] > > In the first four blocks, the third character in the fourth > element is #"c". I want these four blocks split apart. Getting at > the character in question is easy (foreach b example [print pick > fourth b 3]), but unsorting the blocks from there? > > Any help appreciated > HY -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.