Newbie question: Howto remove only first element from a list
Subject: Newbie question: Howto remove only first element from a list
From: Alexey Beshenov
Date: Fri, 25 Apr 2008 18:27:35 +0400
On Friday 25 April 2008 18:18, Raymond Toy (RT/EUS) wrote:
> andre maute wrote:
> > What is the command to remove only the first element from a list?
> >
> > (%i2) a : [1,2,3,4,1];
> > (%o2) [1,2,3,4,1]
> > (%i3) delete(1,a);
> > (%o3) [2,3,4]
>
> rest(a) -> [2,3,4,1]
>
> Hmm. I see there's a bug in the documentation for rest. It refers to
> <n>, but it's not one of the parameters to rest.
rest(expr,n) removes first (n>0) or last (n<0) elements; rest(expr) is
equivalent to rest(expr,1)
rest([1,2,3,4,1]) -> [2, 3, 4, 1]
rest([1,2,3,4,1], 2) -> [3, 4, 1]
rest([1,2,3,4,1], 3) -> [4, 1]
rest([1,2,3,4,1], 4) -> [1]
rest([1,2,3,4,1], 5) -> []
--
Alexey Beshenov <al at beshenov.ru>
http://beshenov.ru/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20080425/e899066e/attachment.pgp