Re: Programming

*To*: mathgroup at smc.vnet.net*Subject*: [mg2826] Re: Programming*From*: wagner at bullwinkle.cs.Colorado.EDU (Dave Wagner)*Date*: Sat, 23 Dec 1995 03:17:30 -0500*Organization*: University of Colorado, Boulder

In article <4b8583$app at dragonfly.wri.com>, Jack Goldberg <jackgold at umich.edu> wrote: >Hi Group; > > Here is my problem: Suppose BuiltIn[expr_] is an >operation either native to Mma or an operation appearing in >some complicated, lengthly package. Suppose that BuiltIn >does not always work. (An example might be Integrate which >fails to find the anti-derivative Integrate[1/(1+Log[x]),x].) >When BuiltIn fails I want to try MyOperation[expr_], but ONLY >if BuiltIn fails! Interactively, this is trivial. Whenever >BuiltIn fails, I recognize the failure because Mma echos the >Input in the Output. (The output of Integrate[1/(1+Log[x]),x] >is itself.) Jack, I have seen the following trick used in various packages: foo = BuiltIn[expr]; If[Head[foo] =!= BuiltIn, foo, MyOperation[expr]] Dave Wagner Principia Consulting (303) 786-8371 dbwagner at princon.com http://www.princon.com/princon