MathGroup Archive 2005

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

Search the Archive

Returning an empty sequence

  • To: mathgroup at
  • Subject: [mg63273] Returning an empty sequence
  • From: "Trevor Baca" <trevorbaca at>
  • Date: Thu, 22 Dec 2005 00:04:34 -0500 (EST)
  • Sender: owner-wri-mathgroup at

What's the right way to have an expression evaluate to an empty

I'd like ...

f[n_] :=
    1, "foo",
    2, Sequence[ ],
    3, {"bar"}];

... to work, but instead I get the message

Switch::"argct": "Switch called with 6 arguments. Switch must be called
with an odd number of arguments."

meaning that the Sequence[ ] is flattened in the rhs definition of f[

Is there a way to get f[ ] to evaluate to the empty Sequence[ ] (rather
than Null)?


  • Prev by Date: Re: "Alternating" function
  • Next by Date: Re: "Alternating" function
  • Previous by thread: Re: Speeding up simple Mathematica expressions?
  • Next by thread: Re: Returning an empty sequence