Length feature

*To*: mathgroup at yoda.physics.unc.edu (Mathematica User's Group)*Subject*: Length feature*From*: Keith Clay <clay at galileo.phys.washington.edu>*Date*: Fri, 20 Aug 93 1:30:52 MDT

Okay, somebody explain it to me. I can't fathom the following feature of the Length function: In[1]:= s = 5 Out[1]= 5 In[2]:= t = x Out[2]= x In[3]:= sum = s+t Out[3]= 5 + x (* so far, so good *) In[4]:= Length[sum] Out[4]= 2 (* still looks good *) In[5]:= Length[t] Out[5]= 0 (* zero? *) In[6]:= Length[s] Out[6]= 0 (* zero? *) This makes it impossible to write code that reads Do[ blah; blah; blah, {j, 1, Length[expr]} ] without defining something like MyLength[expr_]:= Max[ 1, Length[expr] ] which works but seems rather silly. Is there a reason why Length[t] = 0? Thanks, Keith clay at galileo.phys.washington.edu