Message Boards Message Boards

0
|
7161 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How do I Split this?

I have different lists which, once joined and sorted, I'd like to split whenever an element from one of the lists appears again. For example:

r = {1, 3, 8}

s = {2, 7}

t = {0, 4, 5, 9}

Joined and sorted: {0, 1, 2, 3, 4, 5, 7, 8, 9}

The output I'm looking for is: {{0, 1, 2}, {3, 4}, {5, 7, 8}, {9}}

How can I do it?

POSTED BY: Fernando Benadon
4 Replies

Yes, I noticed that too when I tested it with the longer lists. I still appreciate it!

POSTED BY: Fernando Benadon
Posted 9 years ago

I deleted my previous answer as the function I wrote was not working properly in general (I guess I was lucky it worked with your values!).

POSTED BY: Xavier Roy

Thanks! I expanded it to five lists (r,s,t,u,v) and it works great.
Deleted my earlier question about recursion limit; figured out I can set $RecursionLimit to a higher value and it runs like a charm

POSTED BY: Fernando Benadon
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract