pure function puzzle
- To: mathgroup at yoda.physics.unc.edu
- Subject: pure function puzzle
- From: wmm at chem.wayne.edu (Martin McClain)
- Date: Fri, 9 Jul 93 17:37:23 EDT
Dear MathGroupers: I need a pure function that operates on {x,{a,b,c}}, where x, a, b, and c are all simple lists. The output must be {Ints[x,a],Ints[x,b],Ints[x,c]}, where Ints means Intersection. You would think this could be based on Thread, but when a,b,c,and x are all lists, Thread seems to get confused. Map also has a problem: it needs a function as its argument, and apparently nested pure functions are not allowed. I can do the required transformation with a compound statement f1 = Intersection[x,#]&; f2 = Map[f1,#]& and then apply f2 to my input, but x is not known ahead of time. I want this function as one step in a long Composition, and I really need a clean, single function of a single argument, producing a single object. Maybe some clever use of Hold, or Evaluate, or something like that ??? Any ideas?