From leavens@larch.cs.iastate.edu Sun Mar 5 16:52:56 2006 Date: Sun, 5 Mar 2006 16:52:56 -0600 (CST) From: Gary T. Leavens To: rmatus@cs.iastate.edu Cc: Com S 342 TAs -- Kewei Tu , Ru He Subject: Re: Homework 6, #3... Hi Rich, On Sun, 5 Mar 2006 rmatus@cs.iastate.edu wrote: > I had tried that last night (though I didn't send you that code) and it got all > the tests but three. My problem was that even when I used that, when I would > call it on a very basic expression, it woudln't give me an answer... or at > least one I thought was correct... For example... > >> (strength-reduce (lit-exp 4)) > # > > That's all I would get. > > Further, when I do one of your examples, such as... > > (strength-reduce > (unary-minus-exp > (binary-op-exp (lit-exp 2) (times-op) (lit-exp 3)))) > > I simply get... # as an answer. But that's not what > you have listed in your homework examples... Is this what I'm supposed to get, > or is this indicitive of a problem I have in my program? I have to ask this > question because there have been other times when our output did not match the > examples, but our output was correct, we just were never told it would be > different. These might in face be correct and don't indicate a problem. Use the procedure unparse-arith-expr to unparse these and present them to you in an understandable form. Or as in the homework, implicitly, you can use equal? to compare the result to something you make up yourself by hand. I added the following to clarify the problem in homework 6. Thanks for bringing this to my attention. However, during your testing you may find that parse-arith-expr, unparse-arith-expr, and equal? are quite useful, and it's fine to use them in doing testing. In particular unparse-arith-expr will show you the output in parsed form. Alternatively, use DrScheme's printing to see the results of tests. To do this in DrScheme, select the Language menu, and then "Choose Language", then (at the bottom left) click on the button that says "Show Details", then from the right side, under "output syntax" choose "constructor", and click on the "OK" button. Does that help? 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 Sun Mar 5 17:12:42 2006 Date: Sun, 5 Mar 2006 17:12:42 -0600 (CST) From: Gary T. Leavens To: Com S 342 , Com S 342 TAs -- Kewei Tu , Ru He Subject: Re: Homework 6, #3 and testing/printing Hi all, Rich Mathus brought up the issue of seeing the output in testing for homework 6 problem 3. I added some text to the homework to clarify, which is below: However, during your testing you may find that parse-arith-expr, unparse-arith-expr, and equal? are quite useful, and it's fine to use them in doing testing. In particular unparse-arith-expr will show you the output in parsed form. Alternatively, use DrScheme's printing to see the results of tests. To do this in DrScheme, select the Language menu, and then "Choose Language", then (at the bottom left) click on the button that says "Show Details", then from the right side, under "output syntax" choose "constructor", and click on the "OK" button. Thanks to Rich for pointing this out. On any of the problems it's fine to use the unparse-X procedures during testing and debugging. It also is easier to see what's going on in debugging if you turn on the constructor printing. To see what constructor printing means, consider the following session with DrScheme without constructor printing: Welcome to DrScheme, version 301. Language: Typedscm, typed extension to EoPL(2e). Teachpack: C:\cygwin\usr\local\PLT\teachpack\drscheme-342-teachpack.scm. > (require (lib "arith-expr-mod.scm" "lib342")) > (unary-minus-exp (binary-op-exp (lit-exp 2) (times-op) (lit-exp 3))) # Now the same with constructor printing... Welcome to DrScheme, version 301. Language: Typedscm, typed extension to EoPL(2e) custom. Teachpack: C:\cygwin\usr\local\PLT\teachpack\drscheme-342-teachpack.scm. > (require (lib "arith-expr-mod.scm" "lib342")) > (unary-minus-exp (binary-op-exp (lit-exp 2) (times-op) (lit-exp 3))) (unary-minus-exp (binary-op-exp (lit-exp 2) (times-op) (lit-exp 3))) The second output is easier to follow, I'm sure you'll agree. 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 Sun Mar 5 17:14:16 2006 Date: Sun, 5 Mar 2006 17:14:16 -0600 (CST) From: Gary T. Leavens To: David Bireta Cc: Com S 342 TAs -- Kewei Tu , Ru He Subject: Re: Homework 6 Problem 3 Hi David, On Sun, 5 Mar 2006, David Bireta wrote: > When running the test for the strength-reduce procedure i get something like > this: > > (strength-reduce (binary-op-exp (lit-exp 4) (exponent-op) (lit-exp 2))) > ==> # > EXPECTED: # > <== (binary-op-exp (lit-exp 4) (times-op) (lit-exp 4)) > > It appears that i am returning a binary-op-exp, but it looks like the test > is looking for more. Am I supposed to output the actual list as well? See the email which I just sent. If you turn on constructor printing it should show you what each thing is. 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 Mon Mar 6 22:33:14 2006 Date: Mon, 6 Mar 2006 22:33:13 -0600 (CST) From: Gary T. Leavens To: Michael Ekstrand Subject: Re: (CS342) Error starting DrScheme Hi Michael, On Mon, 6 Mar 2006, Michael Ekstrand wrote: > Dr. Leavens: > > I'm running DrScheme 301 with the latest lib342.zip installed in my > ~/.plt-scheme/301/collects directory. DrScheme gives me the following > error message at startup: > > compile: variable not provided > (directly or indirectly and at the expected position) from module: > |,/net/home/michael/.plt-scheme/301/collects/typedscm/tc-types| in: > |tc:error-type-expr? > > Typedscm is not available in the Languages dialog after this has > happened. And I had to clear my ~/.plt-scheme/plt-prefs.ss file to even > get DrScheme to successfully start (with Typedscm set as the > language, it would hang indefinitely). > > I can use MzScheme with typedscm loaded in my .mzschemerc just fine. > > I have encountered this problem on both Debian and FreeBSD (both > running PLT 301). I can successfully start DrScheme on Popeye with SSH > X forwarding; I don't know what version of lib342 is in use there. You should go to the PLT directory and run bin/setup-plt (on your unix-like box). (On windows, you would run "./Setup PLT".) This has to be done every so often, and I do it each time I install a new library to prevent these problems. I do this on popeyey and the Lab Linux machines to prevent these problems. 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 -----------------------