MathGroup Archive 2004

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

Search the Archive

Re: Compile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45612] Re: Compile
  • From: Maxim <dontsendhere@.>
  • Date: Fri, 16 Jan 2004 06:05:33 -0500 (EST)
  • References: <bti21a$a8p$1@smc.vnet.net> <btr1g5$kh1$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Yet another peculiarity: compare

In[1]:=
Module[{y = x}, Compile[{x}, Evaluate @ y]]
Block[{x = 1}, %[2]]

Out[1]=
CompiledFunction[{x$},x,"-CompiledCode-"]

Out[2]=
1.

and

In[1]:=
Module[{y = x}, Compile[{{x, _Real}}, Evaluate @ y]]
Block[{x = 1}, %[2]]

Out[1]=
CompiledFunction[{x},x,"-CompiledCode-"]

Out[2]=
2.

Or, even simpler,

In[1]:=
Function[x, Compile[{x}, x]][1]
Function[x, Compile[{{x, _Real}}, x]][1]

Out[1]=
CompiledFunction[{x},x,"-CompiledCode-"]

<warning messages>

Out[2]=
Compile[{{1,_Real}},1]

So the idea was to treat Compile as a scoping construct, but the possibility of a
different format of the first Compile argument was overlooked.

Maxim Rytin
m.r at prontomail.com



  • Prev by Date: Re: how to delete duplicate items in the same list
  • Next by Date: using functions with package name prefixed.
  • Previous by thread: RE: RE: RE: Re: Compile
  • Next by thread: Re: Mathematica 5.0 "RunThrough" Command