Re: Single-step evaluation in Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg81289] Re: Single-step evaluation in Mathematica
• From: Chris Chiasson <chris.chiasson at gmail.com>
• Date: Tue, 18 Sep 2007 05:53:19 -0400 (EDT)
• References: <fclape\$f7b\$1@smc.vnet.net>

```On Sep 17, 2:36 am, Szabolcs Horv=E1t <szhor... at gmail.com> wrote:
> I would like to have a function, hasOwnValue, that takes the name of a
> symbol as a string, and tells whether the symbol has an own-value.  It
> should do this without evaluating the value of the symbol.
>
> Examples:
>
> abc := Print["side effect"]
> xyz =.
>
> In := hasOwnValue["abc"] (* "side effect" must not be printed *)
> Out = True
>
> In := hasOwnValue["xyz"]
> Out = False
>
> How can I achieve this?
>
> This is a practical problem that I ran into, but the general question
> is:  What do you do when you feel the need for *single-step evaluation*
> in Mathematica?  E.g. how can I manipulate/transform held expressions
> made up of symbols that have values?  An artificial example:
>
> a = 1
> Hold[{a,b,c}]
>
> How do I reverse the list inside Hold?  I could map Hold to each
> element, reverse the list, hold the list again, and remove Hold from
> individual elements to get Hold[{c,b,a}], but this is very inconvenient.
>
> Szabolcs

It would be quite trivial to achieve single step evaluation if the
*Values of all the system variables were readable. However, they are
not.

http://library.wolfram.com/conferences/devconf99/villegas/UnevaluatedExpres=
sions.nb

(or, in HTML)

http://library.wolfram.com/conferences/devconf99/villegas/UnevaluatedExpres=
sions/

Also, I would recommend these two posts for the held evaluation
properties of Block, With, Module, RuleCondition, \$ConditionHold, and
the multi argument Function:

http://forums.wolfram.com/mathgroup/archive/2007/Aug/msg00958.html

http://forums.wolfram.com/mathgroup/archive/2007/Sep/msg00327.html

--
http://chris.chiasson.name/

```

• Prev by Date: Re: coupled map lattice problem
• Next by Date: Linux V6: slow input
• Previous by thread: Re: Single-step evaluation in Mathematica
• Next by thread: piecewise functions from logical relationships (ie. solving with constraints)