From leavens@larch.cs.iastate.edu Wed Mar 2 14:02:12 2005 Date: Wed, 2 Mar 2005 14:02:12 -0600 (CST) From: Gary T. Leavens To: Matthew J. Ring Cc: Com S 342 TAs -- Brian Patterson , Daniel Patanroi Subject: Re: hw6, Q3 Hi Matt, On Wed, 2 Mar 2005, Matthew J. Ring wrote: > I'm trying to grab the datum value of the lit-exp field for problem three to > compare to see if it is equal to 2. I'm not sure what I'm "allowed" to do, > since I have to use cases. > > I could run the right-arg through my eval-arith-expr from question 2. > However, I might encounter the rare situation where the sub-expression ends > up equal to 2 (e.g. (4 * (+ 3 (- 1))) ) > > Any suggestions? The problem is written so that you can and should ignore expressions that are equal to 2. You only have to deal with those that are literally 2. So you can ignore arguments like (+ 3 (- 1)) Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 -------------------------------------------- From leavens@larch.cs.iastate.edu Wed Mar 2 18:21:14 2005 Date: Wed, 2 Mar 2005 18:21:14 -0600 (CST) From: Gary T. Leavens To: An HoGeun Cc: Com S 342 TAs -- Brian Patterson , Daniel Patanroi Subject: Re: cs342 hw6 question Hi An HoGuen, On Wed, 2 Mar 2005, An HoGeun wrote: > I have question about problem 2 > In the grammar, I was wondering if the type name should be > rather than ? > Or if the grammar is correct, why do we use the datatype infix-op which is > defined by (define-datatype infix-op infix-op?... That's an excellent point. I have changed the grammar comments in the homework and the file as you suggested. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 -------------------------------------- A few common problems with the problems involving modules in homework 6: Q: Why can't I run inf-set-comprehend after I do (load "inf-set-as-proc.scm")? A: Because you need to use (require "inf-set-as-proc.scm") instead. Q: I get an error when I use require saying my inf-set-member? isn't defined. A: Make sure you put your code for that in the module inf-set-as-proc (or whatever) and that you saved it in a file with that name. Save the file before executing the require in the interactions window. Having the code somewhere else won't do. If that's not the problem, be sure to do the require given in the homework before starting testing. Q: Why do I get the message: procedure application: expected procedure, given: (make-inf-set-comprehend (lambda (a1) ...)); arguments were: 7 when I run the tests on inf-set-as-ast? A: Because you have code that looks like (s1 x) where s1 is a variant record. You need to use a procedure in places like this. Think of following the grammar or rewrite your code in the procedural rep to not use the fact that sets are procedures except when you have to, and then translate again. --------------------------------- From leavens@larch.cs.iastate.edu Mon Mar 7 23:41:07 2005 Date: Mon, 7 Mar 2005 23:41:07 -0600 (CST) From: Gary T. Leavens To: Matthew J. Ring Cc: Com S 342 TAs -- Brian Patterson , Daniel Patanroi Subject: RE: Weird issue Hi Matt, On Mon, 7 Mar 2005, Matthew J. Ring wrote: > Ok, I created the shell of all the procedures, and tried to run the test > case in the interactions window just to see if my original error had been > corrected. It hasn't. I'm missing some critical, but tiny detail here... > > When it runs, I get the following error: > > "reference to undefined identifier: inf-set-comprehend" > > I've attached my code. I don't see anything out of the ordinary in my code > that would justify this. It must be you arent' using "require". If I use your code, I can do: > (require "inf-set-as-proc.scm") > inf-set-comprehend # > (test-hw6 "inf-set") Test case of $Date: 2005/02/28 20:40:33 $ ... in the interactions window. This does what it is supposed to, except that your code (which is just stubs) doesn't work. But that's to be expected. So you have to use (require "inf-set-as-proc.scm") before testing. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------