From lliao@ren.eecis.udel.edu Fri Oct 11 11:21:28 2002 Date: Fri, 11 Oct 2002 11:20:44 -0400 (EDT) From: Li Liao To: Damian Dechev Subject: Re: interp problem > > thank you very much for your hint, I had the same problem with ifelse and > now I've fixed it. This helped me run the first two cases without a problem, > but when I try to interpret test case 3 (mul) and test case 4(fact) I get > the following error : > - interp "case4"; > ? 4 > uncaught exception NotFound > > and I cannot understand where my mistake is ? > This exception of NotFound is due to failure in looking up "mul" in the procedure "fact". It is not the problem of your code, but the way you use the testing cases. It is partially my fault. To save space I simply did not repeat procedures previously defined: for example, you need to cut the source code of testing case 2 and paste it at the beginning of the testing case 3 since "sum" is called in "mul". I already modified the testing cases posted on the bboard accordingly. This should help get rid of the errors. Li > ----- Original Message ----- > From: "Li Liao" > To: "Damian Dechev" > Sent: Thursday, October 10, 2002 04:35 PM > Subject: Re: interp problem > > > > > > > > Damian, > > > > The typeerror message is caused by the case "Def" in your exec function. > > The following piece of source code > > /x 1 def > > is parsed into a list of commands: > > > > [Push (Name "x"), Push (Num 1), Def] > > > > When you exec runs into "Def", what is on the value stack is > > > > (Num 1) :: (Name "x") :: [] > > > > Your implementation mistakes the top one as name and the second one as > > value. That is why you receive "TypeError"! > > > > Please let me know if you still have problem! > > > > > > ------------------------------ > > Li Liao > > Assistant Professor > > Computer & Information Sciences > > University of Delaware > > Newark, DE 19716 > > Phone: 302-831-3500 > > Fax: 302-831-8458 > >