Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

Switch and List

  • To: mathgroup at
  • Subject: Switch and List
  • From: PERKINS TYLER R <perkins at>
  • 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

  • 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