Re: Re: Zero or one

*To*: mathgroup at smc.vnet.net*Subject*: [mg63007] Re: [mg62990] Re: Zero or one*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Sun, 11 Dec 2005 04:56:30 -0500 (EST)*References*: <200512060503.AAA02671@smc.vnet.net><dn5oan$nj4$1@smc.vnet.net> <200512101102.GAA29338@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 10 Dec 2005, at 20:02, dkr wrote: > The following definitions are not equivalent: > > In[1]:= > optional1[expr_] := expr | ___ ? (Length[{#}] == 0&); > optional2[expr_]:=expr|___?(#==Null&); > > In[3]:= > MatchQ[{1,,3},{1,optional1[2],3}] > Out[3]= > False > In[4]:= > MatchQ[{1,,3},{1,optional2[2],3}] > Out[4]= > True > Yes, I never considered the possibility of a List with missing entries (explicit Null). The reason why the definitions are not equivalent is that Null vanishes only when it is the final value returned by a computation, so Length[{Null}] 1 Of course it is not entirely obvious which interpretation of "0 or 1" is more correct in the case of something like {1, ,3}. Would you say that the second entry ("nothing") is correctly described as "0 or 1 of something"? Or is "Null", a "positive nothingness" and quite different from the simple "absence of anything"? Actually, in Mathematica it is sometime one and sometime the other. But just in case anybody takes this too seriously I believe philosophical considerations of the nature of nothingness are best left to writers like Stanislaw Lem ;-) Andrzej Kozlowski

**References**:**Zero or one***From:*"Trevor Baca" <trevorbaca@Gmail.com>

**Re: Zero or one***From:*"dkr" <dkrjeg@adelphia.net>