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

MathGroup Archive 2001

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

Search the Archive

Problem overriding simple built-in functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28796] Problem overriding simple built-in functions
  • From: Jean-Christophe Deschamps <jchd at worldnet.fr>
  • Date: Sun, 13 May 2001 03:28:45 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I'm told the following occurs under Mathematica v4.0:

In[1]:= GCD[{3, 6}]
Out[1]= {3, 6}
In[2]:= GCD[x_List] := Apply[GCD, x]
In[3]:= GCD[{3, 6}]
Out[3]= GCD[{3, 6}]
In[4]:= Apply[GCD, {3, 6}]
Out[4]= 3

Why is it so? It looks like the override is ignored, but why?

The same exerpt seems to work fine under version 2.x.


  • Prev by Date: Re: i don't want intersection
  • Next by Date: variables versus functions
  • Previous by thread: Re: Det[]
  • Next by thread: Re: Problem overriding simple built-in functions