Re: To be or not to be...
- To: mathgroup at smc.vnet.net
- Subject: [mg62049] Re: To be or not to be...
- From: albert <awnl at arcor.de>
- Date: Thu, 10 Nov 2005 02:50:31 -0500 (EST)
- References: <dksd37$h58$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ingolf Dahl wrote: > > To Mathgroup, > > Try the following commands in order: > > b = Sequence[] > > b == Sequence[] > > b != Sequence[] > > b === Sequence[] > > b =!= Sequence[] > > The four last lines all evaluate to "True" for me. Quite amazing! Was that a question? The reason is that Equal[], SameQ[], UnsameQ[], Unequal[] all return True if called with zero (or one) arguments, which is in fact what you are doing, since Sequence[] does what it is meant to do, no matter whether the head of the expression is List, Equal or UnsameQ. If you want to test whether something is a Sequence[] or not you will need another approach, a simple way is to use a head with Attribute SequenceHold: SetAttributes[ccc, SequenceHold] ccc[b] =!= ccc[Sequence[]] ccc[b] === ccc[Sequence[]] which will give the results you probably expected... albert