🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.symbolic
Article #944

Re: all intersections of a list of sets

#944
From: Arthur Rubin
Date: Mon, 04 Jan 1993 19:58
31 lines
1672 bytes
In <C03MqH.DGA@news.cso.uiuc.edu> Richard J. Gaylord <gaylord@ux1.cso.uiuc.edu> writes:

>ulf wostner asked me how to return all of the intersections of a list of
>sets.

>eg., 

>AllIntersections[{{a,b,c},{b,c,d},{c,d,e}}]
>{{c}, {b, c}, {c, d}, {a, b, c}, {b, c, d}, {c, d, e}}

>he and i are surprised that Outer[Intersection, sets, sets] doesn't work
>at all {in fact, i can't figure out what its doing or why}.

>anyway, i made up a nested anonymous function kind of thing to do it. 

>AllIntersections[set_] :=
>Union[Flatten[Map[(Map[Function[y, Intersection[#,y]], set])&,set], 1]] 

>AllIntersections[{{a,b,c},{b,c,d},{c,d,e}}]
>{{c}, {b, c}, {c, d}, {a, b, c}, {b, c, d}, {c, d, e}}

AllIntersections[set_] :=
List @@ Union[Flatten[Outer[Intersection,list$ @@ set,list$ @@ set]]]

Outer[f,ax,bx] doesn't work the way I would expect if any head of a member
of ax is the same as the head of ax.
--
Arthur L. Rubin: a_rubin@dsg4.dse.beckman.com (work) Beckman Instruments/Brea
216-5888@mcimail.com 70707.453@compuserve.com arthur@pnet01.cts.com (personal)
My opinions are my own, and do not represent those of my employer.
My interaction with our news system is unstable; please mail anything important.
Technical Details
Message-ID: <a_rubin.726177491@dn66>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!ucivax!news.service.uci.edu!beckman.com!dn66!a_rubin
References: <C03MqH.DGA@news.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!ucivax!news.service.uci.edu!beckman.com!dn66!a_rubin
Newsgroups: sci.math.symbolic
Subject: Re: all intersections of a list of sets
Message-ID: <a_rubin.726177491@dn66>
From: a_rubin@dsg4.dse.beckman.com (Arthur Rubin)
Date: 4 Jan 93 19:58:11 GMT
References: <C03MqH.DGA@news.cso.uiuc.edu>
Organization: Beckman Instruments, Inc.
Nntp-Posting-Host: dn66.dse.beckman.com
Lines: 31