Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Mathematica daily WTF

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115059] Re: Mathematica daily WTF
  • From: kj <no.email at please.post>
  • Date: Thu, 30 Dec 2010 04:08:44 -0500 (EST)
  • References: <ifcnhn$bai$1@smc.vnet.net>

In <ifcnhn$bai$1 at smc.vnet.net> Murray Eisenberg <murray at math.umass.edu> writes:

>Copying attributes seems to be simple (or am I missing something?):

>   mysin = Sin;
>   Attributes[mysin]
>{}
>   SetAttributes[mysin, Attributes[Sin]]
>   Attributes[mysin]
>{Listable, NumericFunction, Protected}

>But subsequent removal of attributes can require another step, as here, 
>where Protected is one of the attributes.

>   Unprotect[mysin]
>{mysin}
>   Remove[mysin]

No, my point is that there is no simple way (that I know of) to
fully "clone" a symbol, i.e. create in one swoop a full, independent
replica of the original, with all its associated values (including
not only own-values, but also attributes, down-values, up-values,
sub-values, etc.).  I'm not saying it's impossible to do, but the
language does not facilitate it.  What it provides is basically a
way to set up an *alias* for a symbol, but if the original symbol
gets Remove'd, the alias becomes, in a sense, empty.  So "alias"
is very different from "clone".

~kj


  • Prev by Date: C compiler and XLL framework
  • Next by Date: Re: Question about exponent
  • Previous by thread: Re: Mathematica daily WTF
  • Next by thread: Re: Mathematica daily WTF