Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!reed!intelhf!littlei!omepd!ichips!inews!cyclops!alexw From: alexw@cyclops.intel.com (Alex Witkowski) Newsgroups: comp.sys.handhelds Subject: Re: overloading operators Message-ID: <1071@inews.intel.com> Date: 25 Nov 90 22:05:12 GMT References: Sender: news@inews.intel.com Reply-To: alexw@cyclops.UUCP (Alex Witkowski) Organization: Intel Corporation, Santa Clara, CA Lines: 24 In article bagchi@eecs.umich.edu (Ranjan Bagchi) writes: > > Is there any way I can take a function, such as '+', and >modify it to apply to data-structures (Tagged, I suppose) which it >didn't previously? > I've been screwing around with simulating matrices with nested >lists, and would be much happier if I could multiply 'em with 'x', as >opposed to calling a function called 'mult'. > I would suggest that you modify your 'mult' function to check the type of object in the stack using the built-in TYPE function. If it is a list, apply the old 'mult' function, otherwise perform the built-in 'x' function. Then assign this modified function to the 'x' key and activate user-mode. Now, whenever you type 'x' with your lists in the stack, it will perform your 'mult' function and otherwise it will perform the built-in 'x' function. Alex ------------------------------------------------------------------------------- Alex Witkowski Intel Corporation internet: alexw@t12sys.intel.com Santa Clara, CA 95051 uucp: ...!{decwrl|hplabs!oliveb}!intelca!t12sys!alexw