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

MathGroup Archive 2007

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

Search the Archive

Re: Releasing several Holds simultaneously

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82304] Re: [mg82248] Releasing several Holds simultaneously
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 17 Oct 2007 04:03:12 -0400 (EDT)
  • References: <200710160727.DAA08807@smc.vnet.net>

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[_]]]

Regards,

Ssezi


  • 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