Re: Unprotect[] Protect[] redefining builtin but keep original available
- To: mathgroup at smc.vnet.net
- Subject: [mg131570] Re: Unprotect[] Protect[] redefining builtin but keep original available
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Tue, 3 Sep 2013 23:35:13 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <kucorf$a47$1@smc.vnet.net>
On 2013-08-13 07:56:31 +0000, roby said: > Dear Group > > Is it in general possible to redefine mathematica builtins but still > call the original function from within (but not only from there) the > redefinition ? > > In particular I would like to overload a builtin (distinguished by an > additional Option additionalopt->o) and keep the possibility to call > the original (distinguished by omitting the additional Option or > by setting additionalopt->None) > > Regards Robert Take a look here (practially the same as Chris's answer): http://stackoverflow.com/questions/4198961/what-is-in-your-mathematica-tool-bag/5149656#5149656 Many people on Mathematica.SE refer to this technique as the "Villegas-Gayley trick" To see many real world uses of the technique, you can look at this search: http://mathematica.stackexchange.com/search?q=villegas+gayley