Newbie question: Howto remove only first element from a list



On Fri, Apr 25, 2008 at 10:10 AM, andre maute <andre.maute at gmx.de> wrote:

> What is the command to remove only the first element from a list?
>

Maxima has no destructive list operations -- it mostly treats lists as
immutable -- , so you cannot remove an element from a list.

        a:[1,2,3]$
        delete(1,a) => [2,3]
        rest(a) => [2,3]
        a =>  [1,2,3]          <<< list is unmodified

What you can do is take the "rest" of a list and assign it.

        a:[1,2,3]$
        a: rest(a)$
        a => [2,3]

This does not modify other variables looking at the same list value:

         a:[1,2,3]$
         b:a$
         a: rest(a)$
         a => [2,3]
         b => [1,2,3]

            -s