MathGroup Archive 2000

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

Search the Archive

Re: List element manipulation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25465] Re: [mg25408] List element manipulation
  • From: BobHanlon at aol.com
  • Date: Sun, 1 Oct 2000 02:44:53 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 9/29/2000 1:44:15 AM, Martin_Rommel at mac.com writes:

>I want to decrement the last number in list.

decrementLast[x_List] := (x /. {start___, end_} :> {start, end - 1})

decrementLast[{a, b, c}]

{a, b, -1 + c}

decrementLast[Range[10]]

{1, 2, 3, 4, 5, 6, 7, 8, 9, 9}


Bob Hanlon


  • Prev by Date: Re: LegendreP & Gauss quad bug
  • Next by Date: RE: List element manipulation
  • Previous by thread: Re: LegendreP & Gauss quad bug
  • Next by thread: RE: List element manipulation