MathGroup Archive 2007

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

Search the Archive

Re: Whitespace weirdness.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74363] Re: Whitespace weirdness.
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 19 Mar 2007 21:49:18 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <etlcva$o16$1@smc.vnet.net>

wooks wrote:
> Clear[Eternity,x];
> Eternity[x_]:=Eternity[x];

Totally buggy function definition for his definition leads to infinite 
recursion.

> Clear[EmptyQ];
> EmptyQ[{}] := True;
> EmptyQ[x_List] := False;
> EmptyQ[x_] := Print["Argument to EmptyQ must be a list."];
> 
> Clear[length,list,f,g]
> Function[f,
>     Function[list,If[EmptyQ[list],0,
>                                             1+f[Rest[list]]]]]
>
> [Function[g,
 >
> Function[list,If[EmptyQ[list], 0,
>                                                                 1 +
> g[Rest[list]]]]][Eternity]]
> 
> Clear[length,list,f,g]
> Function[f,
>   Function[list,If[EmptyQ[list],0,
>                                           1+f[Rest[list]]]]]
> [Function[g,Function[list,If[EmptyQ[list], 0,
==^
Funny extra open square bracket.
                                                                1 +
> g[Rest[list]]]]][Eternity]]
=================^=^^^^^^^^
Missing open square bracket.
The symbol Eternity is not defined. Maybe you wanted Eternity[x]?

>  Here are 2 versions of the same anonymous function. The only
> difference between them is that in the second version Function[g....
> starts on a new line.

No. See my comments above.

> One of them works. 

No. As written above, none of them work, and none of them can work.

> The other generates a syntax error.

You should post the code and some tests with their exact results and 
associated error/warning messages directly copied (preferably in 
InputForm) from a fresh Mathematica session. For instance,

In[1]:=
Clear[Eternity, x];
Eternity[x_] := Eternity[x];

In[3]:=
Eternity["Bonjour"]

 From In[3]:=
  $IterationLimit::"itlim" : "Iteration limit of (4096) exceeded. More...

Out[3]=
Hold[Eternity[Bonjour]]

Regards,
Jean-Marc


  • Prev by Date: Re: Integrate
  • Next by Date: Re: NDSolve doesn't stop
  • Previous by thread: Re: Whitespace weirdness.
  • Next by thread: Re: Whitespace weirdness.