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: [mg82285] Re: Releasing several Holds simultaneously
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Wed, 17 Oct 2007 03:53:28 -0400 (EDT)
  • References: <ff1po5$90n$1@smc.vnet.net>

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.

This should work for releasing all Holds in expr:

Replace[expr, Hold[e___] :> e, {0, Infinity}, Heads -> True]

-- 
Szabolcs


  • Prev by Date: Mathematica 3DPlot Making Objects
  • Next by Date: Applying Math 6
  • Previous by thread: Re: Releasing several Holds simultaneously
  • Next by thread: Re: Releasing several Holds simultaneously