MathGroup Archive 2007

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

Search the Archive

Re: Releasing several Holds simultaneously

On Oct 16, 2007, at 3:27 AM, Andrew Moylan wrote:

> Hold[a := Hold[1]]
> How can I release both of these Holds (and thus execute a:=1)
> simultaneously?
> ReleaseHold[%] doesn't work; it evaluates a := Hold[1] before the  
> other hold
> is removed.
> % /. Hold[x_]:>x does the same thing, because /. only matches once  
> per part.

I believe you mean a=1 not a:-=1, but you can use MapAt to put the  
ReleaseHolds in the right place before evaluation:

MapAt[ReleaseHold[#] &, Hold[a = Hold[1]],
  Position[Hold[a = Hold[1]], Hold[_]]]



  • Prev by Date: Re: Efficient creation of regression design matrix
  • Next by Date: Re: Transparently passing on options to other functions
  • Previous by thread: Re: Releasing several Holds simultaneously
  • Next by thread: RE: Releasing several Holds simultaneously