MathGroup Archive 1992

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

Search the Archive

Switch and List


Maybe I'm missing something, but are people missing the elegant solution here?
Why redefine Switch?

In[1]:= theList = {_Real, 1, _Integer, 2, _String, 3}; (* or whatever *)

In[2]:= x = 3;

In[3]:= Switch @@ Join[{x}, theList] (* @@ is Apply *)

Out[2]= 2

(Just couldn't stand it anymore! :o)
	Tyler Perkins		perkins at spot.colorado.edu






  • Prev by Date: Switch and List
  • Next by Date: PDE's, the wave equation, and separation of variables
  • Previous by thread: Switch and List
  • Next by thread: Switch and List