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 1993

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

Search the Archive


  • To: mathgroup at
  • Subject: Lists
  • From: neilb at (RiemannZeta(s))
  • Date: Thu, 28 Jan 93 16:51:11 EST

Hi, I am try to add one to the last element of a list.
For example

>In[1]:= l={x,y,z}
>Out[1]= {x, y, z}
>In[2]:=  l/.l[[Length[l] ]]->l[[Length[l] ]]+1
>Out[2]= {x, y, 1 + z}

which works fine,

>In[3]:= l={x,y,z,0}
>Out[3]= {x, y, z, 0}
>In[4]:=  l/.l[[Length[l] ]]->l[[Length[l] ]]+1
>Out[4]= {x, y, z, 1}


>In[5]:= l={x,z,y,0,0}
>Out[5]= {x, z, y, 0, 0}
>In[6]:=  l/.l[[Length[l] ]]->l[[Length[l] ]]+1
>Out[6]= {x, z, y, 1, 1}
which is curious. Does anybody know why
this doesn't produce

Many thanks

  • Prev by Date: General Protection Fault in WIndows
  • Next by Date: Symposium on QE & CAD
  • Previous by thread: General Protection Fault in WIndows
  • Next by thread: Re: Lists