MathGroup Archive 2000

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

Search the Archive

Set in Scan


Dear MathGroup members

I have to do replacements in very long lists. An efficient way to do 
this is to use

x[[index]]=newElement.

This, however, doesn't work if I want to do replacements for a set of 
lists. If I try to replace the third element in the lists v1, v2 and v3 by 
typing

Scan[#[[3]] = newElement &, {v1,v2,v3}]
I get the error message
Set::setps: #1 in assignment of part is not a symbol.

Any suggestions?
Thanks


Johannes Ludsteck
Centre for European Economic Research (ZEW)
Department of Labour Economics,
Human Resources and Social Policy
Phone (+49)(0)621/1235-157
Fax (+49)(0)621/1235-225

P.O.Box 103443
D-68034 Mannheim
GERMANY

Email: ludsteck at zew.de


  • Prev by Date: Re: Help! Mathematica on my 500MHz outperforms my GHz machine!
  • Next by Date: Check[] *and* Off[]
  • Previous by thread: Re: Re: Help! Mathematica on my 500MHz outperforms my GHz machine!
  • Next by thread: Re: Set in Scan