MathGroup Archive 2011

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

Search the Archive

Re: special iterator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120685] Re: special iterator
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 3 Aug 2011 19:19:54 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j15773$b4v$1@smc.vnet.net>

On Aug 1, 5:40 am, lorenzo <lorenzo_... at yahoo.it> wrote:
> Thanks for all the answers,
>
> I used Delete, apparently it returns a list without the j-th element and 
the original list is not affected by any side effect:
>
> wi = Function[{x, j, func, data},
>    Product[func[x - Delete[data, j][[i]]],  
>    {i, 1, Length[data] - 1}]];


You said: "...and the original list is not affected by any side
effect:"

That's not surprising as it is true for many / most functions working
on some argument: they work on a copy of the argument and return a
copy too. Exceptions are functions like AppendTo and the like.

Cheers --Sjoerd




  • Prev by Date: Re: Simple Doppler effect
  • Next by Date: Re: Generating a Sequence of Plot Style Directives
  • Previous by thread: Re: In Version 8, Combinatorial&GraphTheory functions
  • Next by thread: Re: Feature idea (may already be there)