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

MathGroup Archive 2011

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

Search the Archive

Re: Why FullDefinition does not work in MathLink mode?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120558] Re: Why FullDefinition does not work in MathLink mode?
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Fri, 29 Jul 2011 04:41:43 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201107281155.HAA04113@smc.vnet.net>

>From the documentation of Definition, in Possible Issues section:


Definition is an output form; it does not evaluate:

In[1]:= Definition[Plus]
Out[1]=
Attributes[Plus]={Flat,Listable,NumericFunction,OneIdentity,Orderless,Protected}

Default[Plus]:=0

In[2]:= FullForm[%]
Out[2]//FullForm= Definition[Plus]


Regards,
Leonid


On Thu, Jul 28, 2011 at 3:55 PM, Alexey Popkov <lehin.p at gmail.com> wrote:

> Hello,
>
> When working with MathKernel in interactive session without of the
> FrontEnd, FullDefinition works as expected:
>
> In[1]:= a=2;FullDefinition[a]
>
> Out[1]= a = 2
>
> But when trying to use it in MathLink mode one get ReturnPacket with
> unevaluated FullDefinition:
>
> In[1]:= kernel=LinkLaunch[First[$CommandLine] <> " -mathlink"];
> LinkRead[kernel];
> LinkWrite[kernel,Unevaluated[a=2;FullDefinition[a]]]
> LinkRead[kernel]//FullForm
>
> Out[4]//FullForm= ReturnPacket[FullDefinition[a]]
>
> The built-in parallelization functions have the same problem:
>
> In[2]:= ParallelEvaluate[a=2;FullDefinition[a]]//FullForm
> Out[2]//FullForm= List[FullDefinition[a],FullDefinition[a]]
>
> One workaround is to use ToString:
>
> In[3]:= ParallelEvaluate[a=2;ToString[FullDefinition[a]]]
> Out[3]= {a = 2,a = 2}
>
> Why FullDefinition returns unevaluated in MathLink session although it
> works as expected in interactive MathKernel session? Is it possible to
> make it working without any glitches?
>
> Any ideas?
>
>



  • Prev by Date: FinancialData errors
  • Next by Date: Re: Timing progress bar
  • Previous by thread: Why FullDefinition does not work in MathLink mode?
  • Next by thread: hatched regions, shading, and fills