MathGroup Archive 2008

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

Search the Archive

Re: assignment problerm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94143] Re: assignment problerm
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Fri, 5 Dec 2008 07:04:31 -0500 (EST)
  • Organization: University of Bergen
  • References: <ghavn6$o73$1@smc.vnet.net>

Ignacio Plazeta wrote:
> Dear Friends
> 
> The following code won't work and returns the error
> Set::setps: "{{1,<<9>>,<<22>>},<<9>>,<<111172>>} in the part \
> assignment is not a symbol."
> 
> 
> But
> 
> myData[[myList[[k]], 16]] = myValue;
> 
> outside the function does what is expected !
> 
> 
> I'm incapable to understend the reason and fix the problem;
> can someone give me an hint ?
> 
> Thanks a lot.
> Warmest regards.
> 
> Ignacio
> 
> 
> setBranca[myData_, myList_, myValue_] := Module[{tmp},
> 
>    Table[
> 
>      If[
> 
>        myData[[myList[[k]], 16]] == "",
> 
>        myData[[myList[[k]], 16]] = myValue;
> 
>        ];
> 
>      ,{k, 1, Length[myList]}
> 
>      ];
> 
>    ]
> 
> setBranca [myArchive, {1, 2, 3}, "myNewValue"]
> 

Hello,

Use SetAttributes[setBranca, HoldFirst].

-- 
Szabolcs


  • Prev by Date: Re: Position of Last Element in List
  • Next by Date: Re: Newbie question: Which is more versatile, Table[] or Array[]?
  • Previous by thread: assignment problerm
  • Next by thread: Position of Last Element in List