Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

RE: Structure modification and related questions

  • To: mathgroup at
  • Subject: [mg13893] RE: [mg13857] Structure modification and related questions
  • From: Daniel CLEMENT <dclement at>
  • Date: Sun, 6 Sep 1998 02:55:30 -0400
  • Sender: owner-wri-mathgroup at

> ----- Original Message -----
> From:	Roberto Moriyon [SMTP:Roberto.Moriyon at]
To: mathgroup at
> Sent:	Wednesday, September 02, 1998, 7:30:54
> To:	mathgroup at
> Subject:	[mg13857] Structure modification and related questions
> x=Table[i, {i,10000}]
> Q.1) Can I modify x[[3]], let's say, without having to create another
> list of 10000 elements? (the obvious thing for me to try, x[[3]]=0,
> does not work).
According to me this is the role of the ReplacePart function:

> Q.3) Related to Q.1&2, is it possible in Mathematica that two structures
> (or lists, for that sake) have some parts in common? What I mean by
> this is that, for example, I would like to have the variable x equal to
> the second element of {1,{2,3},4}, so that in case the 3 is changed by
> a 5 in one of them, it is also changed in the other one.
It is enough to use SetDelayed (:=):
list1=ReplacePart[list1,5,{2,2}] (the 3 is at place {2,2} in list1)

x is now {2,5}

> ----- End Of Original Message -----



  • Prev by Date: Binary Files
  • Next by Date: Mathematica & the Mac--file locations.
  • Previous by thread: Re: Structure modification and related questions
  • Next by thread: how can i save a text from noteboook ?