Re: EUREKA Re: Types in Mathematica, a practical example

*To*: mathgroup at smc.vnet.net*Subject*: [mg63192] Re: EUREKA Re: [mg62800] Types in Mathematica, a practical example*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Sat, 17 Dec 2005 03:46:28 -0500 (EST)*References*: <43A1787000069CF6@pne-smtpout2-sn2.hy.skanova.net> (added by postmaster@pne.skanova.net) <DB6CBF61-D563-47BF-B707-FEFA7B843E06@mimuw.edu.pl>*Sender*: owner-wri-mathgroup at wolfram.com

On 17 Dec 2005, at 08:16, Andrzej Kozlowski wrote: >> >> Occasionally, when you have defined some of the undefined >> elements, you may >> convert to Input Form or have to apply ReleaseHold or >> ReplaceAll[#,HoldForm[Part[a__]]:>Part[a]]& @ to get rid of the >> invisible >> HoldForm surrounding the indexed elements. For Set and SetDelayed >> you can >> get this automatically by the command > > Hm... have you really tried it: > > > > ReplaceAll[#,HoldForm[Part[a__]]:>Part[a]]& @x > > > {{HoldForm[x[[1,1]]], > HoldForm[x[[1,2]]]}, > {3, HoldForm[x[[2,2]]]}} It seems I forgot to copy and paste enough from Mathematica to make my point clear. So here it is more fully. Define: x = Array[HoldForm[x[[##1]]] & , {2, 2}] {{HoldForm[x[[1,1]]], HoldForm[x[[1,2]]]}, {HoldForm[x[[2,1]]], HoldForm[x[[2,2]]]}} Now set x[[1,1]] to 3 x[[1,1]] = 3; x Out[6]= {{3, HoldForm[x[[1,2]]]}, {HoldForm[x[[2,1]]], HoldForm[x[[2,2]]]}} Let's remove HoldForm (you can use ReplaceAll[#,HoldForm[Part [a__]]:>Part[a]]& @ as you suggested: it won't make any difference): x /. HoldForm -> Identity Out[7]= {{3, HoldForm[x[[1,2]]]}, {HoldForm[x[[2,1]]], HoldForm[x[[2,2]]]}} You see, nothing changed at all because when HoldForm[x[[1,2]]] was released x[[1,2]] was immediately replaced by HoldForm[x[[1,2]], etc. In fact I completely fail to see any benefits of having HOldForm here compared with (for example) defining x=Array[Unique[x]&,{2,2}] Have I missed your point? Andrzej Kozlowski