MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Intersection[...,SameTest] ?


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) 
	&&#1==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[])


  • Prev by Date: Large Files
  • Next by Date: which book is good to learn the programming in Mathematica?
  • Previous by thread: Large Files
  • Next by thread: which book is good to learn the programming in Mathematica?