MathGroup Archive 2001

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

Search the Archive

Is this a bug?

  • To: mathgroup at
  • Subject: [mg32047] Is this a bug?
  • From: Paul van Wamelen <wamelen at>
  • Date: Thu, 20 Dec 2001 03:42:11 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Is the following a bug?

Mathematica 4.1 for Sun Solaris
Copyright 1988-2000 Wolfram Research, Inc.
 -- Motif graphics initialized -- 

In[1]:= k[x_] := Module[{},Print["hallo world"];x];

In[2]:= a[5] = 0;

In[3]:= a[k[5]]++
hallo world
hallo world

Out[3]= 0

I would have expected only one "hallo world" and it would seem to be
more efficient to only evaluate the k[5] once...

The above example is not important but in the form below it had me
baffled for a while:

In[4]:= tst[n_] := Module[{a},
  a[0] = a[1] = 0;
In[5]:= tst[50]

Out[5]= {24, 24}

(Does not add up to 50!)


  • Prev by Date: Fortran-MathLink
  • Next by Date: Displaying Mathematica's Global rules
  • Previous by thread: Fortran-MathLink
  • Next by thread: Re: Is this a bug?