Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Assigning part of indexed object

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119829] Re: Assigning part of indexed object
  • From: "Fabrice P. Laussy" <fabrice.laussy at n0spam-gmail.com>
  • Date: Fri, 24 Jun 2011 07:46:43 -0400 (EDT)
  • References: <itsjn7$8u7$1@smc.vnet.net> <itv7ve$pbu$1@smc.vnet.net>

Dear all,

Thanks for the solution. Supplemented with Oleksandr Rasputinov's fix:

> Unprotect[Set];
> Set[sym_[[part_]], val_] := sym = ReplacePart[sym, part -> val];
> Protect[Set];

it works splendidly.

In "some elements of Mathematica Design (1992)" [http://goo.gl/nm1tT], 
Stephan Wolfram makes a point where one should resist the temptation to 
design functions to do things that look natural for them to do, as they 
could break dramatically later on.

Here we have a clear case where Set seems it ought to work as redesigned by 
Oleksandr. Is there any reason for this not being the default behaviour? 


  • Prev by Date: Re: pattern example
  • Next by Date: Re: Export a Grid[] object without loosing it's format
  • Previous by thread: Re: Assigning part of indexed object
  • Next by thread: Re: Assigning part of indexed object