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 2000

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

Search the Archive

Summary: List element manipulation

  • To: mathgroup at
  • Subject: [mg25467] Summary: List element manipulation
  • From: "Martin Rommel" <rommel at>
  • Date: Sun, 1 Oct 2000 02:44:54 -0400 (EDT)
  • References: <8r19qf$>
  • Sender: owner-wri-mathgroup at

Thanks to the many helpful people that replied with their insight.
The straightforward fix to my problematic

> MapAt[Decrement, Range[116, 166, 8], -1]
>     Decrement::"rvalue": "164 is not a variable with a value, so its value
> cannot be changed."

is using a function # - 1& instead of Decrement (which is not a mathematical
function but instead listed under programming assignments in the help

MapAt[# - 1&, Range[116, 166, 8], -1]

This was suggested by the news group veterans David Park, Andrzej Kozlowski,
Hartmut Wolf and Allan Hayes.

Matt Johnson suggested an alternative using a rule (it is always interesting
to see things done differently)

Range[116, 166, 8] /. {h___, t_} -> {h, t - 1}

Special thanks to Andrzej Kozlowski for additonal explainations but the most
in depth coverage came from my compatriot Hartmut Wolf.

With hindsight I don't understand why I was so fixated on employing


  • Prev by Date: Re: I do not understand
  • Next by Date: Re: LegendreP & Gauss quad bug
  • Previous by thread: Re: How to solve the system of linear equations?
  • Next by thread: Re: Summary: List element manipulation