Re: Intersection[...,SameTest->test] ?
- To: mathgroup at smc.vnet.net
- Subject: [mg33093] Re: Intersection[...,SameTest->test] ?
- From: Konstantin L Kouptsov <klk206 at is5.nyu.edu>
- Date: Fri, 1 Mar 2002 06:52:28 -0500 (EST)
- Organization: New York University
- References: <a5htcj$hsk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks to all who answered. Indeed, in version 4 the mentioned function works without problems; with the answer being as much meaningful as the "test" being the "equivalence" predicate (well, sometimes it is just what one needs). My examples were run using version 3.0, in which the implementation of Intersection[..., SameTest->test] is buggy. Konstantin. Konstantin L Kouptsov wrote: > > Intersection[..., SameTest->test] seem to do just that. However: > > 1. It is not clear from the manual (book or help browser), what this command > is supposed to return. > > 2. It simply does not work: > > In[83]:= > a={1,2,3,4}; > b={2,4,7,8}; > Intersection[a,b,SameTest->(#1==2*#2&)] > > Out[83]= > {1} > > or more sophisticated: > > In[85]:= > a={1,2,3,4}; > b={2,4,7,8}; > Intersection[a,b,SameTest-> > ((Print[#1,"=?=",#2]||True) > &==2*#2 > &&(Print[True]||True)&) > ] > > 2 =?= 1 > True > 3 =?= 1 > 4 =?= 3 > 2 =?= 1 > True > 4 =?= 3 > 4 =?= 4 > > Out[85]= > {1} > > which does not seem to enumerate all pairs. > > What idea stands behind this function? what is supposed to do? > > (well, for my task I sure could run double For[] cycle, but I am > curious about Intersection[])