Switch and List
- To: mathgroup at yoda.physics.unc.edu
- Subject: Switch and List
- From: PERKINS TYLER R <perkins at spot.colorado.edu>
- Date: Tue, 28 Jan 1992 15:56:03 -0700
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