Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.9K Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

[?] Avoid problem with Outer?

I have a couple of lists .Let us say:

up = {{x1, x4, x5}, {x2, x8}, {x3}, {x6, x7}};
uq = {{x1, x3, x5}, {x6}, {x2, x4, x7, x8}};
ur = {{x1, x5}, {x6}, {x2, x7, x8}, {x3, x4}};

I want to tale the intersection between their subsets. It is easy enough:

Outer[Intersection, up, uq, ur, 1]}, 
DeleteCases[Flatten[paso1, 2], {}]]

But now I want to make a general function that receives a list of lists and performs the same operation. Something like

f[x_List]:= ...

How can I do it? I have not found how to make Outer take the lists from the list containing them, and perform correctly the operation.

Thanks for any help,

Francisco

Posted 9 years ago

Try this:

Rest[Union[Flatten[Outer[Intersection, up, uq, ur, 1], 2]]]

Union removes doublettes, Rest drops the empty set at the beginning

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