Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4121 > unrolled thread

Re: [Mathematica] special iterator

Started bylorenzo <lorenzo_ktm@yahoo.it>
First post2011-08-01 03:40 +0000
Last post2011-08-03 23:24 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: [Mathematica] special iterator lorenzo <lorenzo_ktm@yahoo.it> - 2011-08-01 03:40 +0000
    Re: special iterator "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-08-03 23:24 +0000

#4121 — Re: [Mathematica] special iterator

Fromlorenzo <lorenzo_ktm@yahoo.it>
Date2011-08-01 03:40 +0000
SubjectRe: [Mathematica] special iterator
Message-ID<j15773$b4v$1@smc.vnet.net>
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}]];

[toc] | [next] | [standalone]


#4170 — Re: special iterator

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-08-03 23:24 +0000
SubjectRe: special iterator
Message-ID<j1clar$g5p$1@smc.vnet.net>
In reply to#4121
On Aug 1, 5:40 am, lorenzo <lorenzo_...@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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web