Intersection[...,SameTest] ?
- To: mathgroup at smc.vnet.net
- Subject: [mg33054] Intersection[...,SameTest] ?
- From: Konstantin L Kouptsov <klk206 at is5.nyu.edu>
- Date: Wed, 27 Feb 2002 00:48:19 -0500 (EST)
- Organization: New York University
- Sender: owner-wri-mathgroup at wolfram.com
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[])