Date: Fri, 25 Aug 2000 09:38:45 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: xiaolin sun Subject: Re: Question about Hw0 Content-Type: text/plain; charset=us-ascii Xiaolin, xiaolin sun wrote: > I'm having a couple of questions about 10--12 of Hw: > > 1) Do you expected us to only answer Q10 on the base > of that Web Site( java.sun....) ? You can use other material > 2)what about 11 and 12? what's the clue we can depend > on? or you hope we answer them according to our > original knowledge? or base on "CLASS LANGUAGE DESIGN > DISCUSSION" > covered at last class? Of course maybe the remaining > will be presented in this Friday's class, sorry for my > hurry! Yes, we will discuss that today in class. > > By the way, the book on reserve is in library? it's > not available there. The books should be on reserve in the Mathematical Sciences library, not the big library, but the one in MacLean Hall. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Fri Aug 25 16:52:07 2000 Return-Path: Received: from ren.cs.iastate.edu (leavens@ren.cs.iastate.edu [129.186.3.41]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id QAA04862 for ; Fri, 25 Aug 2000 16:52:06 -0500 (CDT) Received: (from leavens@localhost) by ren.cs.iastate.edu (8.9.0/8.9.0) id QAA16987; Fri, 25 Aug 2000 16:52:02 -0500 (CDT) Date: Fri, 25 Aug 2000 16:52:02 -0500 (CDT) Message-Id: <200008252152.QAA16987@ren.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: why the .login trick in HW0, problem 5, doesn't make $PUB defined? *** EOOH *** Date: Fri, 25 Aug 2000 16:52:02 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: why the .login trick in HW0, problem 5, doesn't make $PUB defined? A few students, and Yan Liu noted that when log in to a workstation, the instructions in homework 0, problem 5, don't seem to make the shell variable PUB be defined. It turns out that when you start an xterm on one of our workstations in MacLean Hall, you aren't executing your ~/.login file at all. The solution is to copy the two lines in question: setenv PUB /space/leavens/WWW/ui54 setenv PATH ${PATH}:$PUB/bin also to the end of your ~/.cshrc file. The ~/.cshrc file gets executed whenever you start up an xterm session. (If you are using bash, then you should copy a version of these to your .bashrc file.) Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Aug 28 23:01:54 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id XAA17432 for ; Mon, 28 Aug 2000 23:01:53 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000829040147.AAK6803.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 28 Aug 2000 21:01:47 -0700 Message-ID: <39AB3640.AA390D3C@cs.uiowa.edu> Date: Mon, 28 Aug 2000 23:04:16 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: xiaolin sun CC: leavens@cs.iastate.edu Subject: Some clarifications to homework 0, problems 10-12 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 28 Aug 2000 23:04:16 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: xiaolin sun CC: leavens@cs.iastate.edu Subject: Some clarifications to homework 0, problems 10-12 Content-Type: text/plain; charset=us-ascii A student after class asked what was the language "Simple" mentioned in homework 0? We did never call the langauge anything, but I was intending to call it "Simple". Sorry for any confusion on that score. About homework 0, problems 11 ff. xiaolin sun wrote: > 2)about 11 > [What is a] combination ? It seems I > misunderstand the meaning of Question 11. In Scheme a "combination" is a procedure call, like (p x y (+ z 1)). > 3)what 's the means of abstraction? It must be covered > in today's class, but I maybe lost in this part. A means of abstraction is a declaration form. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Tue Aug 29 18:50:36 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id SAA14184 for ; Tue, 29 Aug 2000 18:50:34 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000829235027.HEMJ26973.mail.rdc1.il.home.com@cs.uiowa.edu>; Tue, 29 Aug 2000 16:50:27 -0700 Message-ID: <39AC4CCF.D12D77A9@cs.uiowa.edu> Date: Tue, 29 Aug 2000 18:52:47 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng CC: leavens@cs.iastate.edu Subject: Re: HW0 question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Tue, 29 Aug 2000 18:52:47 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng CC: leavens@cs.iastate.edu Subject: Re: HW0 question Content-Type: text/plain; charset=us-ascii Zhen-fang Feng, Zhen-fang Feng wrote: > But I still want to know: > 1) What is the clue to answer the question "why doesn't the syntax of Java > look like Simple"? I don't normally give out additional clues. Is there something about the problem that you don't understand? Consider the goals and history of each language. > 2) I don't quite understand the requirement for problem 11. For example, > in Scheme the if-expression is (if b e1 e2), are supposed to say that the > if-expression in Java is > ... You can say that if you think it's the right answer. Again, I'm not going to correct this by email. The problem asks for the equivalent of an if-expression, which is an expression, not a statement. > > 3) Could it be possible for you to give me an example of means of > abstraction in Java? No, that would answer the question. You are supposed to give two such examples. Examples of abstraction in Scheme are declarations like (define class 54) and (define add1 (lambda (x) (+ 1 x))). Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Fri Sep 1 00:19:06 2000 Return-Path: Received: from ren.cs.iastate.edu (leavens@ren.cs.iastate.edu [129.186.3.41]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id AAA20110 for ; Fri, 1 Sep 2000 00:19:05 -0500 (CDT) Received: (from leavens@localhost) by ren.cs.iastate.edu (8.9.0/8.9.0) id AAA07203; Fri, 1 Sep 2000 00:19:01 -0500 (CDT) Date: Fri, 1 Sep 2000 00:19:01 -0500 (CDT) Message-Id: <200009010519.AAA07203@ren.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: Re: Question on Homework #1, #1 j *** EOOH *** Date: Fri, 1 Sep 2000 00:19:01 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: Re: Question on Homework #1, #1 j Matt Shera wrote: > I had a question about the box and pointer problem, I > believe part j of question number 1. I'm a little confused about the > second and third ones. The first one is easy. If you had the list > (1 (2 3)) would it look like this: --------- --------- | 1 | *-|----->| * | / | --------- --|------ | v --------- --------- | 2 | *-|----->| 3 | / | --------- --------- > or would it look like this: --------- | 1 | * | ------|-- | v --------- --------- | 2 | *-|----->| 3 | / | --------- --------- > I was trying to think about this in > terms of the car and cdr of a list and was just getting myself more > confused. I'm leaning towards the second of my two diagrams. The first diagram is correct for the list (1 (2 3)). The list (1 (2 3)) is a 2-element list, where the second element is itself a list. This is what your first diagram shows. Another way to see this is to try building the list using cons and the empty list. If you do (cons 1 (cons (cons 2 (cons 3 '())) '())) you'll get the list (1 (2 3)). Each cons makes a pair. So you need 4 pairs in the diagram. The second diagram corresponds to the list (1 2 3). Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Fri Sep 1 16:43:51 2000 Return-Path: Received: from ren.cs.iastate.edu (leavens@ren.cs.iastate.edu [129.186.3.41]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id QAA10822 for ; Fri, 1 Sep 2000 16:43:51 -0500 (CDT) Received: (from leavens@localhost) by ren.cs.iastate.edu (8.9.0/8.9.0) id QAA03619; Fri, 1 Sep 2000 16:43:46 -0500 (CDT) Date: Fri, 1 Sep 2000 16:43:46 -0500 (CDT) Message-Id: <200009012143.QAA03619@ren.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: how to read the Little Schemer *** EOOH *** Date: Fri, 1 Sep 2000 16:43:46 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: how to read the Little Schemer When reading the Little Schemer, don't worry if you don't know the answer to a question. That always happens when they introduce a new piece of information. So when you don't know the answer, just read it and don't worry. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Sep 3 23:43:18 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id XAA24225 for ; Sun, 3 Sep 2000 23:43:18 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000904044313.OQGB1430.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 3 Sep 2000 21:43:13 -0700 Message-ID: <39B32925.14E1A4EC@cs.uiowa.edu> Date: Sun, 03 Sep 2000 23:46:29 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: HW1 question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 03 Sep 2000 23:46:29 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: HW1 question Content-Type: text/plain; charset=us-ascii Zhen-fang Feng, You wrote: > Dear Prof. Leavens, > > I don't quite understand for the reqirement for some problems which > require code and transcript. For example, I write code as the attached > file hw.scm, and then I make the transcript for them. When I open the > transcript hw.out, there is any userful information in this file. When you do a load of your Scheme file, any defines in it are defined, and the expressions are executed, but you won't see any of that from a transcript that just loads the file. So for homework 1, part e, for example, you will need to type the expressions in to the Scheme interepreter directly, instead of trying to have the file you load do them. You can also cut and paste them from a file, if you want to avoid typing them again. Sorry for the confusion. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 4 17:54:49 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id RAA11041 for ; Mon, 4 Sep 2000 17:54:49 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000904225446.GBLZ1430.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 4 Sep 2000 15:54:46 -0700 Message-ID: <39B428F7.D6F9D6D2@cs.uiowa.edu> Date: Mon, 04 Sep 2000 17:57:59 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: HW1 question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 04 Sep 2000 17:57:59 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: HW1 question Content-Type: text/plain; charset=us-ascii Zhen-fang Feng, It sounds like you are making the output of the script session the same as your Scheme input file (the .scm file). Be sure to use a different file name for the session output. It's possible the files are linked, if you used the Unix "ln" command, that's unlikely, but would also cause this problem. Gary Zhen-fang Feng wrote: > Dear Prof. Leavens, > > When I try to make a trascript and sometime I got the error messages. Then > I use the (exit) and exit command to go back to the Unix shell prompt. > When I try to open my .scm file, its code is totally changed--something > like those in the script file. The original codes is overwritten. I have > encountered this problem for several times. I'm very frustrated. Could you > please tell me what I should do to prevent this happens again? > > Thanks for your time and have good afternoon. > > Zhen-fang Feng  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Wed Sep 6 12:11:10 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id MAA04639 for ; Wed, 6 Sep 2000 12:11:08 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000906171105.ELWL1430.mail.rdc1.il.home.com@cs.uiowa.edu>; Wed, 6 Sep 2000 10:11:05 -0700 Message-ID: <39B67B72.F2623BD0@cs.uiowa.edu> Date: Wed, 06 Sep 2000 12:14:26 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: michael_barnes@ia.net Subject: Re: 22C:054 homework References: <200009061707.MAA14907@server.divms.uiowa.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Wed, 06 Sep 2000 12:14:26 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: michael_barnes@ia.net Subject: Re: 22C:054 homework Content-Type: text/plain; charset=us-ascii Michael, Yes, typed and printed is even preferred, as it will be easier for the Yan Liu to read. Gary michael_barnes@ia.net wrote: > I just want to make sure about this, in the homework when you say > something should be "handwritten", is typed and printed okay? > > Help save the rain forests, http://rainforest.care2.com/  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Fri Sep 8 12:41:50 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id MAA14264 for ; Fri, 8 Sep 2000 12:41:49 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000908174147.IXBO21578.mail.rdc1.il.home.com@cs.uiowa.edu>; Fri, 8 Sep 2000 10:41:47 -0700 Message-ID: <39B925A3.B4B0AF07@cs.uiowa.edu> Date: Fri, 08 Sep 2000 12:45:07 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Matthew Philip Shera Subject: Re: typing References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Fri, 08 Sep 2000 12:45:07 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Matthew Philip Shera Subject: Re: typing Content-Type: text/plain; charset=us-ascii Matt, You wrote: > Dr. Leavens, > could you explain to me what this means. I guess I'm basically looking > for a translation. In class on Wednesday you wrote the definition of the > procedure "map" on the board and I understood that fine. But, when you > wrote the deftype up there I didn't get it. This was the deftype: > > (deftype map > (-> ((-> (s) t) > (list s)) > (list t))) > > What's it mean? Thanks This means that map has a type that is a procedure type (-> (...) ...). The type given is that of a procedure that takes 2 arguments, the first of which is itself a procedure of type (-> (s) t), and the second a list of type (list s). The result of map is a list of type (list t). The names "s" and "t" used in these types stand for arbitrary types. For example, s could be number and t could be number, which allows us to apply map to a procedure of type (-> (number) number) and a list of type (list number); if we do that, we have to replace the "s" and "t" consistently, getting the return type of (list number) for an application like (map (lambda (n) (+ 1 n)) '(1 2 3)) The notation for types is explained in the file type-notation.txt available in $PUB/docs and also from the course web pages at http://www.cs.uiowa.edu/~leavens/ui54/docs/type-notation.txt If you'd rather learn by doing, run the program scm54typed and try entering some Scheme expressions or definitions at the prompt. It will tell you their types. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Fri Sep 8 13:39:04 2000 Return-Path: Received: from larch.cs.iastate.edu (larch.cs.iastate.edu [129.186.3.5]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id NAA15700 for ; Fri, 8 Sep 2000 13:39:03 -0500 (CDT) Received: (from leavens@localhost) by larch.cs.iastate.edu (8.9.0/8.9.0) id NAA10695; Fri, 8 Sep 2000 13:38:57 -0500 (CDT) Date: Fri, 8 Sep 2000 13:38:57 -0500 (CDT) Message-Id: <200009081838.NAA10695@larch.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: answer to anonymous feedback *** EOOH *** Date: Fri, 8 Sep 2000 13:38:57 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: answer to anonymous feedback Hi, I've gotten a couple of questions about homework details in the anonymous feedback. Please send them by email, or they may not be answered in time... But here's a more normal suggestion. > Could you give us the solution of the Homework. I'd be happy to explain any particular problem solution in class or in my office to you. Indeed, since we don't have a discussion section, that's a really good idea that we should do. However, I'd rather not give out canned solutions, as they can be copied by other students in other semesters... > Could the TA give us the sum of our homework. Yes, we should be adding these up for you, and we'll be posting grading summaries as time goes on. > Are you going to give the average of the homework? Note that your grade is independent of other people's grades. So the average can't matter to your grade. However, we can post a summary of the homework grades once in a while if you're really interested. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Fri Sep 8 14:08:09 2000 Return-Path: Received: from larch.cs.iastate.edu (larch.cs.iastate.edu [129.186.3.5]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id OAA16361 for ; Fri, 8 Sep 2000 14:08:08 -0500 (CDT) Received: (from leavens@localhost) by larch.cs.iastate.edu (8.9.0/8.9.0) id OAA10944; Fri, 8 Sep 2000 14:08:02 -0500 (CDT) Date: Fri, 8 Sep 2000 14:08:02 -0500 (CDT) Message-Id: <200009081908.OAA10944@larch.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: andmap *** EOOH *** Date: Fri, 8 Sep 2000 14:08:02 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: andmap The andmap procedure mentioned on page 24 of the EOPL book is given on page 281 of the book. I've also put a copy in the library. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 11 00:06:20 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id AAA04955 for ; Mon, 11 Sep 2000 00:06:19 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000911050614.PITD21578.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 10 Sep 2000 22:06:14 -0700 Message-ID: <39BC690F.956F5391@cs.uiowa.edu> Date: Mon, 11 Sep 2000 00:09:35 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: litang Subject: Re: References: <8620751025.20000910184731@blue.weeg.uiowa.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 11 Sep 2000 00:09:35 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: litang Subject: Re: Content-Type: text/plain; charset=us-ascii Li Tang, Without the parentheses around the formal parameter name, the lambda defines a procedure that takes any number of arguments. This is thus like the sum and product procedures we did at the end of class Friday. If you put the parentheses in, you have a procedure that takes a single argument, instead of the "unrestricted" version. Gary Li Tang wrote: > Hello Professor Leavens, > On P29 1.3.3, What's the difference between lambda (a) and lambda a? > > > Thank you, > Li Tang mailto:litang@blue.weeg.uiowa.edu  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Wed Sep 13 13:16:38 2000 Return-Path: Received: from server.divms.uiowa.edu (server.divms.uiowa.edu [128.255.28.165]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id NAA18387 for ; Wed, 13 Sep 2000 13:16:37 -0500 (CDT) Received: from cs.uiowa.edu (dhcp206.divms.uiowa.edu [128.255.28.195]) by server.divms.uiowa.edu with id NAA28278; Wed, 13 Sep 2000 13:16:34 -0500 (CDT) Message-ID: <39BFC495.5AD9BFB7@cs.uiowa.edu> Date: Wed, 13 Sep 2000 13:16:53 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Li Tang Subject: Re: References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Wed, 13 Sep 2000 13:16:53 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en To: Li Tang Subject: Re: Content-Type: text/plain; charset=us-ascii Li Tang, Yes, print out both the code and the transcript please. This should be implicit in all coding problems, even if I forgot to mention it (as I apparently did) explicitly in the problem. Gary Li Tang wrote: > Hello Professor Leavens, > About Hw1.5, do we need to print out the transcript? > > Li Tang mailto:ltang@cs.uiowa.edu -- Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Fri Sep 22 20:10:31 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id UAA06142 for ; Fri, 22 Sep 2000 20:10:31 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000923011028.OFAA13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Fri, 22 Sep 2000 18:10:28 -0700 Message-ID: <39CC03DC.55A13B01@cs.uiowa.edu> Date: Fri, 22 Sep 2000 20:14:05 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: Revised due dates (and points) for HW2 in 22C:54 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Fri, 22 Sep 2000 20:14:05 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: Revised due dates (and points) for HW2 in 22C:54 Content-Type: text/plain; charset=us-ascii Zhen-fang Feng, you wrote: > As for "set-remove" in problem 7, do we need to take all occurence of the > the item or just the first occurence of the item? The set-remove procedure takes a set as an argument, so it's argument cannot have any duplicates. Thus taking all occurrences or the first occurrence out are equivalent. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sat Sep 23 18:59:14 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id SAA24471 for ; Sat, 23 Sep 2000 18:59:13 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000923235910.IQOC13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Sat, 23 Sep 2000 16:59:10 -0700 Message-ID: <39CD44A7.E074E72D@cs.uiowa.edu> Date: Sat, 23 Sep 2000 19:02:47 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Xiaoding Luo Subject: Re: References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sat, 23 Sep 2000 19:02:47 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Xiaoding Luo Subject: Re: Content-Type: text/plain; charset=us-ascii Xiaoding Luo you wrote: > Hi, Gary, one question for hw2 16b: > should (instantiate 'boolean 'T '(-> (boolean) boolean)) > return (-> (boolean) boolean) > or (-> (T) T) > ? > According to the home work, I believe it should return the first > result because boolean is not a type variable. Yes, that is correct. > One more question: > When I implement procedures, I do not check if the parameters are > . I assume whenever we call the functions, we will always > use(parse-type-expr) to guaranttee a valid input. Is that all right? Yes, that's exactly right. You don't need to check for valid input, as the parse- procedures have already done that. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sat Sep 23 19:44:15 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id TAA25174 for ; Sat, 23 Sep 2000 19:44:14 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000924004411.JHKA13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Sat, 23 Sep 2000 17:44:11 -0700 Message-ID: <39CD4F34.9661BECE@cs.uiowa.edu> Date: Sat, 23 Sep 2000 19:47:49 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Sonny Pham Subject: Re: Revised due dates (and points) for HW2 in 22C:54 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sat, 23 Sep 2000 19:47:49 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Sonny Pham Subject: Re: Revised due dates (and points) for HW2 in 22C:54 Content-Type: text/plain; charset=us-ascii Sonny Pham you wrote: > Hi Gary! I though we don't have to preventing duplicate in set-add and > set-remove. You do have to prevent duplicates. That's a very important part of the problem. Recall that problem 7 reads... 7. (25 points) [set-ops] In this problem you will write procedures to operate on the ADT of sets. We will implement sets as lists, as noted in the `defrep' declaration below. However, we will use lists *without* duplicate elements. ... > Could you give some help on how to preventing the > duplicate. > In general, you can do this in two ways: 1. don't ever insert a duplicate into the set, 2. take duplicates out before you return the set. The first way is more efficient, and I recommend it. To do this have set-add test to see if the element to be added is already in the set, and if it is, don't put it in the result. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Sep 24 14:35:22 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id OAA08594 for ; Sun, 24 Sep 2000 14:35:21 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000924193518.WZHC13995.mail.rdc1.il.home.com@cs.uiowa.edu> for ; Sun, 24 Sep 2000 12:35:18 -0700 Message-ID: <39CE582F.64F8DA01@cs.uiowa.edu> Date: Sun, 24 Sep 2000 14:38:23 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: leavens@cs.iastate.edu Subject: [Fwd: Question on HW2 in 22C:54] Content-Type: multipart/mixed; boundary="------------C4AE15DFB64E55F31E094D77" *** EOOH *** Date: Sun, 24 Sep 2000 14:38:23 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: leavens@cs.iastate.edu Subject: [Fwd: Question on HW2 in 22C:54] Content-Type: multipart/mixed; boundary="------------C4AE15DFB64E55F31E094D77" >From leavens Sun Sep 24 14:33:28 2000 Date: Sun, 24 Sep 2000 14:36:31 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: Question on HW2 in 22C:54 Content-Type: text/plain; charset=us-ascii X-Mozilla-Status2: 00000000 Zhen-fang Feng wrote: > Gary, > > I got an error message on my attacthed file when I load it using > scm54typed. Could you tell me what is wrong? > Your type declaration: (deftype swapper-exp (-> (symbol symbol sym-exp) (sym-exp))) has incorrect syntax. The (sym-exp) at the end should be just sym-exp (take out the parentheses). Once you do that, you'll get error messages that are more reasonable. To fix them, use the helping procedures in sym-exp.scm from the library, as we discussed in class. Gary  -=- MIME -=-  This is a multi-part message in MIME format. --------------C4AE15DFB64E55F31E094D77 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit --------------C4AE15DFB64E55F31E094D77 Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline >From leavens Sun Sep 24 14:33:28 2000 Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by server.divms.uiowa.edu with id OAA08278; Sun, 24 Sep 2000 14:33:27 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000924193326.WYPL13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 24 Sep 2000 12:33:26 -0700 Message-ID: <39CE57BF.A62164B1@cs.uiowa.edu> Date: Sun, 24 Sep 2000 14:36:31 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: Question on HW2 in 22C:54 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mozilla-Status2: 00000000 Zhen-fang Feng wrote: > Gary, > > I got an error message on my attacthed file when I load it using > scm54typed. Could you tell me what is wrong? > Your type declaration: (deftype swapper-exp (-> (symbol symbol sym-exp) (sym-exp))) has incorrect syntax. The (sym-exp) at the end should be just sym-exp (take out the parentheses). Once you do that, you'll get error messages that are more reasonable. To fix them, use the helping procedures in sym-exp.scm from the library, as we discussed in class. Gary --------------C4AE15DFB64E55F31E094D77--  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Sep 24 17:20:43 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id RAA11439 for ; Sun, 24 Sep 2000 17:20:41 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000924222037.ZPUJ13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 24 Sep 2000 15:20:37 -0700 Message-ID: <39CE7F12.53842B80@cs.uiowa.edu> Date: Sun, 24 Sep 2000 17:24:18 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: Question on HW2 in 22C:54 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 24 Sep 2000 17:24:18 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: Question on HW2 in 22C:54 Content-Type: text/plain; charset=us-ascii Zhen-fang Feng, you wrote: > Gary, > > When I load my file, I get the message: > > > (load "occurs.scm") > > "occurs.scm", line 19: ERROR: list: end of file in ((define occurs-list > (lambda (sym lst) ... > ;STACK TRACE > +; (#@@copy-tree (#@apply #@1+0 (#@cdr #@0+0))) > 0; (#@letrec (filesuf hss . #@define) (#@1+0 (#@has-suffix? #@1+0 ... > 1; (#@load "occurs.scm") > > But when I type (test-hw2 "occurs"), I got "All tests passed!" How can > this happen? You have an extra left parenthesis, or a missing right parenthesis. Look before the spot in the code where the define occurs-list is and see if there is a missing right parenthesis. Also look for an extra left parenthesis. If you use emacs, this is easy to do by deleting the last parenthesis in a procedure definition, and seeing where the match is. I'm not sure how your code can still work, unless Scheme is supplying the missing parenthesis for you somehow. But fix it first. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Sep 24 20:06:13 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id UAA13590 for ; Sun, 24 Sep 2000 20:06:12 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000925010609.CMXU13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 24 Sep 2000 18:06:09 -0700 Message-ID: <39CEA5DE.7DB08B17@cs.uiowa.edu> Date: Sun, 24 Sep 2000 20:09:51 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: Question on HW2 in 22C:54 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 24 Sep 2000 20:09:51 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: Question on HW2 in 22C:54 Content-Type: text/plain; charset=us-ascii Zhen-fang Feng You wrote: > Gary, > > I still got the "inferred" error. > > typed> (load "flaten.scm") > Type checking "flaten.scm" ... > flatten : (-> (sym-exp) (list t)) > flatten-list : (-> (list s) (list t)) > Error: Definition does not match declared type (with deftype) for: > flatten-list > Expected (declared) type: (-> (list s) (list t)) > Inferred type : (-> ((list sym-exp)) (list symbol)) > flatten-list : cannot be typed > # : void The type being inferred is the correct type. Change the type you declared to match it. Also the type you are giving for flatten is not exactly right... it also returns a list of symbols. In general, when there is a mismatch, it may be because you didn't code the procedure correctly, or because you didn't declare the type correctly. You have to think about which may be wrong... Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Sep 24 22:34:35 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA15596 for ; Sun, 24 Sep 2000 22:34:34 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000925033431.FIIJ13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 24 Sep 2000 20:34:31 -0700 Message-ID: <39CEC8A4.FE2853BA@cs.uiowa.edu> Date: Sun, 24 Sep 2000 22:38:12 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: jinzhou Subject: Re: question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 24 Sep 2000 22:38:12 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: jinzhou Subject: Re: question Content-Type: text/plain; charset=us-ascii Jin Zhou, You probably forgot to load our sym-exp.scm file from the library. Put (load-quietly-from-lib "sym-exp.scm") at the beginning of your code. That should fix it. Gary jinzhou wrote: > hi, gary, > I got the error message attached below, what is wrong with my code? > "/space/leavens/WWW/ui54/homework/hw2.tst/swapper.tst", line 8: unbound > variable: parse-s-list > ; in expression: (... parse-s-list (quote (a b c d a b c d))) > ; in top level environment. > ;STACK TRACE > +; (parse-s-list (quote (a b c d a b c d))) > 0; (define lst1 (parse-s-list (quote (a b c d a b c d)))) > 1; (#@letrec (filesuf hss . #@define) (#@1+0 (#@has-suffix? #@1+0 ... > 2; (#@test-hw2 "swapper") > > jin zhou  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 25 09:07:03 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id JAA25623 for ; Mon, 25 Sep 2000 09:07:02 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000925140700.PJNG13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 25 Sep 2000 07:07:00 -0700 Message-ID: <39CF5CE2.6AF56D24@cs.uiowa.edu> Date: Mon, 25 Sep 2000 09:10:43 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: michael_barnes@ia.net Subject: Re: subst-with-map References: <200009250706.CAA29789@server.divms.uiowa.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 25 Sep 2000 09:10:43 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: michael_barnes@ia.net Subject: Re: subst-with-map Content-Type: text/plain; charset=us-ascii Michael, You wrote: > Is it legal to have subst-with-map call subst-sym-exp? Yes, of course. I highly recommend doing that. > Also, is currying required for this problem? No, you don't have to use currying. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 25 11:46:38 2000 Return-Path: Received: from server.divms.uiowa.edu (server.divms.uiowa.edu [128.255.28.165]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id LAA00267 for ; Mon, 25 Sep 2000 11:46:37 -0500 (CDT) Received: from cs.uiowa.edu (dhcp206.divms.uiowa.edu [128.255.28.195]) by server.divms.uiowa.edu with id LAA28756; Mon, 25 Sep 2000 11:46:34 -0500 (CDT) Message-ID: <39CF8191.E4BFE552@cs.uiowa.edu> Date: Mon, 25 Sep 2000 11:47:13 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Li Tang Subject: Re: hw2 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 25 Sep 2000 11:47:13 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en To: Li Tang Subject: Re: hw2 Content-Type: text/plain; charset=us-ascii Li Tang, The code you sent me was from my own subst.scm, which doesn't have anything to do with the problem. Li Tang wrote: > Heollo Professor Leavens, > About hw2.7 the last two questions I passed all the test, but > I got type error as follow: > Error: Operator type and argument types do not match in: (set-union > (set-one-elem ls) (set-union-list (set-rest ls))) > Operator type : (-> ((list t) (list t)) (list t)) > Argument type list: (t t) > set-union-list : cannot be typed > Error: Definition does not match declared type (with deftype) for: > set-union* > Expected (declared) type: (-> ((list t) ...) (list t)) > Inferred type : (-> (t ...) (list t)) > set-union* : cannot be typed > > What's going on? The problem is that you're using set-one-elem and set-rest instead of car and cdr. These have different types. Note that set-union-list takes a list of sets, not a set of sets. So try using car and cdr. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 25 18:33:42 2000 Return-Path: Received: from server.divms.uiowa.edu (server.divms.uiowa.edu [128.255.28.165]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id SAA14419 for ; Mon, 25 Sep 2000 18:33:41 -0500 (CDT) Received: from cs.uiowa.edu (dhcp206.divms.uiowa.edu [128.255.28.195]) by server.divms.uiowa.edu with id SAA05891; Mon, 25 Sep 2000 18:33:37 -0500 (CDT) Message-ID: <39CFE0F6.97BA45FE@cs.uiowa.edu> Date: Mon, 25 Sep 2000 18:34:14 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Xiaoding Luo Subject: Re: References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 25 Sep 2000 18:34:14 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en To: Xiaoding Luo Subject: Re: Content-Type: text/plain; charset=us-ascii Xiaoding Luo, Ah, the problem is with step 3 below; you are pasting your code into the interpreter. You should use (load "my code") intsead. The type checker doesn't allow mutually recursive procedures to be entered easily from the top-level. But it does work correctly when you use the type checker and load the code from a file. Gary Xiaoding Luo wrote: > Hi, Gary, I still have problem with type checking. > What I did is as follow: > 1. scm54typed > 2. (load-from-lib "sym-exp-scm") > 3. paste my code or (load "my code") at prompt > 4. there is a type error mesage and as if continue. > 5. I continue by typing y. > 6. (test-hw2 "my file here") > 7. can not pass. > 8. I check with scm54. all tests passed. > > My question: In scm54typed, if you have type error, then the program will > be halted? Yes, it asks if you want to continue. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 25 22:09:35 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA19044 for ; Mon, 25 Sep 2000 22:09:34 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926030930.JXQI13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 25 Sep 2000 20:09:30 -0700 Message-ID: <39D01449.4BB30B43@cs.uiowa.edu> Date: Mon, 25 Sep 2000 22:13:13 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Shawn Garner Subject: Re: References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 25 Sep 2000 22:13:13 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Shawn Garner Subject: Re: Content-Type: text/plain; charset=us-ascii Shawn, I'm not sure what you need by the "Scheme library". But to get the lisp libraries, you need to either get emacs-20.7-fullbin-i386.tar.gz or get what you got and also emacs-20.7-lisp.tar.gz. Gary Shawn Garner wrote: > I downloaded and unzipped emacs 20.7 and it seems to be fine except it > doesn't seem to have the scheme library with it. What do I need to do to > run scheme from emacs. The emacs I have seems to have Lisp libraries with > it. It just a fancy notepad as far as I can tell right now. > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > Share information about yourself, create your own public profile at > http://profiles.msn.com.  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 25 22:26:48 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA19331 for ; Mon, 25 Sep 2000 22:26:48 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926032643.KKDC13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 25 Sep 2000 20:26:43 -0700 Message-ID: <39D01853.D29C229B@cs.uiowa.edu> Date: Mon, 25 Sep 2000 22:30:27 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Suwat Sukchokchai Subject: Re: Could you help me with "deftype"? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 25 Sep 2000 22:30:27 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Suwat Sukchokchai Subject: Re: Could you help me with "deftype"? Content-Type: text/plain; charset=us-ascii Suwat, You wrote: > I wrote procedure for problem 9, without deftype, it works but when I put > the deftype in it complains, Error message. I don't understand, could you > take a look and make some comment? > The error messages are from the type checker, I presume. To fix them you need to use the helping procedures in $PUB/lib/sym-exp.scm, which you need to lead with (load-from-lib "sym-exp.scm"). If you don't do that, then you'll get tyep errors from the library itself. Anyway, you need to write code that uses the helping procedures to do the apporpriate "casting, as in the file $PUB/lib/subst.scm, part of which is below: (deftype subst-sym-exp (-> (symbol symbol sym-exp) sym-exp)) (define subst-sym-exp (lambda (new old symexp) (if (sym-exp-symbol? symexp) (if (eq? old (sym-exp->symbol symexp)) (symbol->sym-exp new) symexp) (s-list->sym-exp (subst new old (sym-exp->s-list symexp)))))) You aren't using symbol->sym-exp, for example. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Sep 25 22:31:28 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA19392 for ; Mon, 25 Sep 2000 22:31:27 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926033123.KNBC13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 25 Sep 2000 20:31:23 -0700 Message-ID: <39D0196A.32332C7F@cs.uiowa.edu> Date: Mon, 25 Sep 2000 22:35:06 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: leavens@cs.iastate.edu Subject: Be sure to load library code using load-from-lib Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 25 Sep 2000 22:35:06 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: leavens@cs.iastate.edu Subject: Be sure to load library code using load-from-lib Content-Type: text/plain; charset=us-ascii Hi, The students who complained in class today about type errors in our library code for sym-exp.scm had made a copy of the file $PUB/lib/sym-exp.scm in their own directory, and were using (load "sym-exp.scm") ;; wrong! The problem is that they didn't also copy the file $PUB/lib/sym-exp.def, and this latter file has information that helps the type checker avoid the errors that would otherwise happen. (In particular the "trustme!" in the .def file does that.) So please, to avoid difficulties, when using something from our library, don't make a copy in your own directory, but use (load-from-lib "sym-exp.scm") ;; works or (load-quietly-from-lib "sym-exp.scm"). This will ensure that any .def files are found by the type checker. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Mon Sep 25 23:16:17 2000 Return-Path: Received: from larch.cs.iastate.edu (larch.cs.iastate.edu [129.186.3.5]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id XAA20342 for ; Mon, 25 Sep 2000 23:16:17 -0500 (CDT) Received: (from leavens@localhost) by larch.cs.iastate.edu (8.9.0/8.9.0) id XAA29019; Mon, 25 Sep 2000 23:16:05 -0500 (CDT) Date: Mon, 25 Sep 2000 23:16:05 -0500 (CDT) Message-Id: <200009260416.XAA29019@larch.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: suggestion for making lecture go faster *** EOOH *** Date: Mon, 25 Sep 2000 23:16:05 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: suggestion for making lecture go faster Someone wrote: > You asked us to think about ways to utilize > lecture time, so we don't fall behind your > schedule. May I suggest that we don't do problems > on paper in class? To me, that seems to be handled > by the homework, and if there are problems with that > the student(s) can e-mail you for clarification (as > I have done, it works quite well). Instead, how > about if you just do an example and let us follow > along? Or you could just ask us, "What should I > do now?" rather than having us take the time to > write it all down. It's true that that takes time. But for really critical skills, like recursion, I think it's essential that everyone get a chance to try it themselves. If one person, or me, does it then others may "tune out". But for things that aren't as critical, I will probably not have students do them on paper during class. Thanks for the suggestion, Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Tue Sep 26 01:23:14 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id BAA22807 for ; Tue, 26 Sep 2000 01:23:12 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926062310.NWDU13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Mon, 25 Sep 2000 23:23:10 -0700 Message-ID: <39D041AE.BB29EF99@cs.uiowa.edu> Date: Tue, 26 Sep 2000 01:26:54 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Suwat Sukchokchai Subject: Re: Could you give more hint? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Tue, 26 Sep 2000 01:26:54 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Suwat Sukchokchai Subject: Re: Could you give more hint? Content-Type: text/plain; charset=us-ascii Suwat, You don't need to give the deftype for map. Since you're using map, you shouldn't need to test the list for null or recurse on the list. (Look at the code for map, it's already doing that.) The code in the procedure that is passed to map should have the type (-> (sym-exp) sym-exp). So your code (sym-exp->s-list (symbol->sym-exp new)) is taking the casting idea too far. Don't try to make the result of that an slist. Similarly, the argument n is already a sym-exp, so you shouldn't need to cast it at all. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Tue Sep 26 11:00:00 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id KAA04375 for ; Tue, 26 Sep 2000 10:59:59 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926155957.ZVPC13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Tue, 26 Sep 2000 08:59:57 -0700 Message-ID: <39D0C8DC.D0CED444@cs.uiowa.edu> Date: Tue, 26 Sep 2000 11:03:40 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: michael_barnes@ia.net Subject: Re: polymorphic? References: <200009261532.KAA07269@server.divms.uiowa.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Tue, 26 Sep 2000 11:03:40 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: michael_barnes@ia.net Subject: Re: polymorphic? Content-Type: text/plain; charset=us-ascii Michael you wrote: > Just to verify, we can assume that the parameter to polymorphic? will be > type ? Yes. You don't need to do error checking. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Tue Sep 26 12:26:04 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id MAA06921 for ; Tue, 26 Sep 2000 12:26:02 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926172558.CEGA13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Tue, 26 Sep 2000 10:25:58 -0700 Message-ID: <39D0DD05.344B5439@cs.uiowa.edu> Date: Tue, 26 Sep 2000 12:29:41 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: michael_barnes@ia.net Subject: Re: Using car with type References: <200009261700.MAA16167@server.divms.uiowa.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Tue, 26 Sep 2000 12:29:41 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: michael_barnes@ia.net Subject: Re: Using car with type Content-Type: text/plain; charset=us-ascii Michael, The trick is in the .def file, $PUB/lib/simple-type-expr.def. This defines the types of the various helpers, and also uses the "trustme!" feature of the typechecker. This feature allows the suppression of the type errors that would otherwise be given. The idea is to allow a file like simple-type-expr.scm to present an abstract data type that does the right thing, but that the type checker isn't good enough to handle. Sorry for the confusion, but things will become clearer later I hope. Gary michael_barnes@ia.net wrote: > I took a look at simple-type-expr.scm, and I'm more bewildered than ever. > In that file you use (car d) and it obviously works fine. When I try it, > I get this error: > > typed> (load "polymorphic") > Type checking "polymorphic.scm" ... > polymorphic? : (-> (type-expr) boolean) > Error: Operator type and argument types do not match in: (car d) > Operator type : (and (-> ((list s)) s) (-> ((pair u t)) u)) > Argument type list: (type-expr) > # : void > typed> > > which I don't understand. I know it's saying that d is not proper input > to car, but not why. If I take the line (eq? (car d) '->) directly from > function-type? and past it into polymorphic? I get that error. ?????? > > Michael > > Help save the rain forests, http://rainforest.care2.com/  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Tue Sep 26 14:48:05 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id OAA11105 for ; Tue, 26 Sep 2000 14:48:04 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000926194754.FXWY13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Tue, 26 Sep 2000 12:47:54 -0700 Message-ID: <39D0FE2B.E06F3DB@cs.uiowa.edu> Date: Tue, 26 Sep 2000 14:51:07 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: michael_barnes@ia.net Subject: Re: Using car with type References: <200009261826.NAA23969@server.divms.uiowa.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Tue, 26 Sep 2000 14:51:07 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: michael_barnes@ia.net Subject: Re: Using car with type Content-Type: text/plain; charset=us-ascii Michael, you wrote: > Yes, that is what I am trying to do. > > It looks like I spoke too soon. My helper function needs to make car take > a , > > (car (helper d)) > > which I thought I had figured out, but it's not working. Any hints? > You should use the helpers in simple-type-expr.scm instead of trying to use car directly. That is, if you're trying to get the arguments of a function type, for example, use function-type->arg-types. Or if you're trying to take the car of a type-expr to see if it is a function type, don't do that, but just use function-type? instead. Gary > > Michael > > In <39D0E1A0.EDA0ED12@cs.uiowa.edu>, on 09/26/2000 > at 12:49 PM, "Gary T. Leavens" said: > > >Michael, > > >You shouldn't use trustme!, but if you just created a helping procedure > >that is fine. The trustme! thing should only be used > >when creating an ADT for a grammar. > > > Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Tue Sep 26 22:14:32 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA20438 for ; Tue, 26 Sep 2000 22:14:31 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000927031427.RUWW13995.mail.rdc1.il.home.com@cs.uiowa.edu>; Tue, 26 Sep 2000 20:14:27 -0700 Message-ID: <39D166D4.2733F90D@cs.uiowa.edu> Date: Tue, 26 Sep 2000 22:17:40 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Suwat Sukchokchai Subject: Re: Help me! References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Tue, 26 Sep 2000 22:17:40 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Suwat Sukchokchai Subject: Re: Help me! Content-Type: text/plain; charset=us-ascii Suwat, The problem is that you made a copy of simple-type-expr.scm in your own directory but didn't make a copy of the .def file simple-type-expr.def. That's what is causing the problem. Instead of doing that, use (load-from-lib "simple-type-expr.scm") which will get both files from the course library. I think I mentioned this earlier on the Q&A page. You should look there for help also... Gary Suwat Sukchokchai wrote: > Hi Garry, > I have a problem with #16. I try to load your helper file > "simple-type-expr.scm" The compiler gives error messages(see below). Can I > ignore these or is this a problem? > > typed> (load "simple-type-expr.scm") > Type checking "simple-type-expr.scm" ... > Error: Operator type and argument types do not match in: (type-expr? (caddr > d)) > Operator type : (-> (t) boolean) > Argument type list: ((list t)) > Error: Mismatch between types of uses and defining expression for: > basic-type? > Type of uses : (-> ((list (list s))) t) > Type of defining expression: (-> (symbol) boolean) > Error: Mismatch between types of uses and defining expression for: > type-variable? > Type of uses : (-> ((list (list s))) t) > Type of defining expression: (-> (symbol) boolean) > Error: Mismatch between types of uses and defining expression for: > function-type? > Type of uses : (-> ((list (list s))) t) > Type of defining expression: (-> ((list symbol)) boolean) > Error: Operator type and argument types do not match in: (parse-type-expr > (caddr d)) > Operator type : (-> (s) t) > Argument type list: ((list t)) > type-expr? : cannot be typed > basic-type? : cannot be typed > type-variable? : cannot be typed > function-type? : cannot be typed > make-basic-type : (-> ((list (list t))) (list (list t))) > make-type-variable : (-> ((list (list t))) (list (list t))) > make-function-type : (-> (symbol symbol) (list symbol)) > type-variable->symbol : (-> ((list (list t))) (list (list t))) > basic-type->symbol : (-> ((list (list t))) (list (list t))) > function-type->arg-types : (-> ((list (list t))) (list t)) > function-type->result-type : (-> ((list (list t))) (list t)) > parse-type-expr : cannot be typed > # : void  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Thu Sep 28 22:35:46 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA28774 for ; Thu, 28 Sep 2000 22:35:44 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000929033540.XOSR22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Thu, 28 Sep 2000 20:35:40 -0700 Message-ID: <39D40EF3.F162D3E2@cs.uiowa.edu> Date: Thu, 28 Sep 2000 22:39:31 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Heath Meyer Subject: Re: deftype given? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Thu, 28 Sep 2000 22:39:31 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Heath Meyer Subject: Re: deftype given? Content-Type: text/plain; charset=us-ascii Heath, you wrote: > Was there a deftype given for the vector-index portion of number 21? No, I want you to know how to write these deftypes, so I intentionally left it out. :-) Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Thu Sep 28 22:58:16 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA29163 for ; Thu, 28 Sep 2000 22:58:15 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000929035811.YDRY22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Thu, 28 Sep 2000 20:58:11 -0700 Message-ID: <39D4143A.DB6BE51@cs.uiowa.edu> Date: Thu, 28 Sep 2000 23:02:02 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Xiaoding Luo Subject: Re: References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Thu, 28 Sep 2000 23:02:02 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Xiaoding Luo Subject: Re: Content-Type: text/plain; charset=us-ascii Xiaoding, you wrote: > Hi, Gary, how do you write deftype for a function that could return > different types of value? eg, ribassoc, I don't want to call two privious > functions. Instead, I want my ribassoc call a helper function which > returns a index or fail-value, depending on the situation. The simple answer is to use a fail-value that is the same type as the index, i.e., a number. Use something like -1. There are other ways to solve this (e.g., have the helper take two procedures with the two different types as arguments, and apply only one of them to the result), but these are more complex. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Oct 1 22:37:14 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id WAA09528 for ; Sun, 1 Oct 2000 22:37:13 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001002033709.FRUA22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 1 Oct 2000 20:37:09 -0700 Message-ID: <39D803C8.5BE1E50C@cs.uiowa.edu> Date: Sun, 01 Oct 2000 22:40:57 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Kailex Patel Subject: Re: info References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 01 Oct 2000 22:40:57 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Kailex Patel Subject: Re: info Content-Type: text/plain; charset=us-ascii Kailex, you wrote: > 1. What is the difference between these two: > (define sym-exp-symbol? > symbol?) > > and > > (define sym-exp->symbol > (lambda (se) > se > error...))) > These have different types for one thing. The first is equivalent to (define sym-exp-symbol? (lambda (se) (symbol? se))) and so it returns a boolean, while the second returns a symbol. The first tests to see if what its argument is is a symbol, the second returns a symbol, and is effectively like a Java cast in its typing. The typing effect, given in the .def file, is that sym-exp-symbol? is like an instanceof test in Java, and the sym-exp->symbol procedure is like a cast in Java. > > 2. > how do we know when to use 2 procedures and when not to? will you let us > know if we have to, in the exam? You can tell by the grammar. Use two procedures for any sym-exp or s-list problem. Use helping procedure for each type. So if the grammar has a list, to process the list, use a helper. And no, I won't tell you what procedures to use during the exam. > 3. > will there be any qstns on cells and cell-ref, and andmap in the exam? It's possible, since we had homework problems on them. But look at the study guide for what I am likely to emphasize. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.iastate.edu Thu Oct 5 01:09:42 2000 Return-Path: Received: from larch.cs.iastate.edu (larch.cs.iastate.edu [129.186.3.5]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id BAA20054 for ; Thu, 5 Oct 2000 01:09:41 -0500 (CDT) Received: (from leavens@localhost) by larch.cs.iastate.edu (8.9.0/8.9.0) id BAA01207; Thu, 5 Oct 2000 01:09:41 -0500 (CDT) Date: Thu, 5 Oct 2000 01:09:41 -0500 (CDT) Message-Id: <200010050609.BAA01207@larch.cs.iastate.edu> From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: Some feedback from the test *** EOOH *** Date: Thu, 5 Oct 2000 01:09:41 -0500 (CDT) From: "Gary T. Leavens" To: leavens@cs.iastate.edu Subject: Some feedback from the test A student writes: > I don't think giving us more homework will solve any problems. Yes, I got that message clearly from the class today. > I think you don't realize the amount of time the current problems take > for us to do. I have trouble getting the assigned problems done let > alone get to the recommended problems or extra credit. I do know that it takes some of you a long time. I believe that they shouldn't take a long time if you follow my advice on how to do such problems, but I fear that you and many others are spending a lot of time in trial and error on the problems. > If you want us to do the recommended problems I think you should > assign them and just have generally less problems. I don't have now > nor have I ever had a class yet that had homework assignment that when > printed takes up 8 pages. Perhaps part of the problem is that at the U of I your classes haven't had much programming work? If you want to be a computer programmer, you're going to have to practice your craft. > Also I think the exam was way too long. I also heard that clearly from class today. > I also thought some of the problems were ill described. Part of the skills needed for this class is a knowledge of what the problems will be like. I expect that you should have enough skill to recognize the problem types from the homework. I also try to avoid this by careful use of both English and examples, and by having the TA look over the test carefully before giving it. I admit that the use of "extract" in problem 2 was, in hindsight, not the best choice of words. > If you want to test us over more > material then you should make the exams half as long and just schedule > them more often. Also I don't think it is fair to compare the time > our TA takes to the whole class. He has more practice with all the > problems than us plus he probably has more experience with scheme than > anyone in the class. Aside from my experience in teaching this class before, I have no other way than using the TA's time to judge how long the test is. Both of these indications failed me this time, I'm afraid. I was mentioning Yan Liu's time in class not to compare your time with his, but to indicate that I had made an effort to ensure that the test would not be too long. (Incidentally, Yan Liu had never programmed in Scheme before this semester, although he has done some Lisp before. I don't think he's doing a lot of the problems either. So I thought it would be a pretty fair estimate to double the time. But alas, he seems to be better than I thought. :-) > I misunderstood two problems and therefore got "0"'s on those two > problems even though I wrote a bunch of code for them. I think on > grading tests you should grade more on what is there rather than what > is not there because you can take away so much that it makes no > difference whether you did anything at all. First, if you have specific questions about grading of a problem, please see me and we can discuss it. Second, I graded the test rather strictly, because I want you to have an honest estimate of what your skills in Scheme are so far, and what needs improvement. If you misunderstood a problem, that is partly a fault on my part for not explaining the problem well, and partly on your part for not knowing what kinds of problems to expect well. However, I must grade what the problem is that is stated on the test; otherwise I have no basis for grading at all, as you could answer any question you please and argue for 100% on that. It is certainly the case that many students got 0 or very few points for problems in which they wrote a lot of code. That's because their code, in my evaluation, doesn't come close to solving the problem, and is confused. I did give partial credit for outlines as indicated, but I saw very few of the correct outlines for some problems. If you have major problems like this, the rest of the homework in the class will take "forever" to do. If this is the case, please come see me and I can try to help clear up the problems. > I think if the test were > a homework assignment I could have done all of the problems. Probably so. > For the > problem with the sym-exp I thought it was mean not to include the > grammer or deftype of what a sym-exp is. I realize it was on a > homework assignment but you told us we didn't have to memorize any of > that stuff. That seems like my mistake. I'm sorry if I gave you the impression I would show the grammar on the test, and will include it on the makeup test. I did include the deftypes for all of the the sym-exp helpers, so I'm not sure what you mean about the deftypes. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Thu Oct 5 18:47:47 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id SAA14778 for ; Thu, 5 Oct 2000 18:47:46 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001005234742.KLWZ22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Thu, 5 Oct 2000 16:47:42 -0700 Message-ID: <39DD1409.6D64EB5A@cs.uiowa.edu> Date: Thu, 05 Oct 2000 18:51:38 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: "M. Allen" Subject: Re: part 5 on hw2 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Thu, 05 Oct 2000 18:51:38 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: "M. Allen" Subject: Re: part 5 on hw2 Content-Type: text/plain; charset=us-ascii Mark, you wrote: > i've been working on this part for quite some time now, and i > think that this problem may encapsulate a lot of the concepts which i'm > having difficulty with in the class.. if you have the time, could you > please look through what i have and possibly point out where i may be > getting off track.. also, i included the error messages... thank you.. [...code omitted...] > Error: Operator type and argument types do not match in: (vector-ref v2 > acc) > Operator type : (-> ((vector t) number) t) > Argument type list: ((list t) t) This is because you are using null? on a vector, at the beginning of ribassoc-finder: (null? v2) You can't ask whether a vector is null or not. What you should be doing asking whether an index into the vector is off the left or right end. Something like (< i 0) ;; off the left end or (>= i (vector-length v2)) ;; off the right end. Think of it as a loop over an array in C++ or Java. I think that is your major mistake. The rest is important syntax and details. Did you try designing the sequence of iterations for a concrete example on paper before coding? That is what I suggest to make this kind of thing easier to code. Otherwise you are working by trial and error. > Error: Operator type and argument types do not match in: (ribassoc-finder > s2 los > 2 v2 x2 (+ 1 acc)) > Operator type : (-> (s) t) > Argument type list: (t t (list t) t number) The above is from the last line in your ribassoc: (ribassoc-finder (s1 los1 v1 x1 0)) You have parentheses around (s1 los1 v1 x1 0), which is essentially a syntax error. This line should read instead (ribassoc-finder s1 los1 v1 x1 0) Sometimes the type checker can spot these for you, but in this case it is guessing the type of s1 and that it's a function... Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Fri Oct 6 09:40:41 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id JAA01340 for ; Fri, 6 Oct 2000 09:40:40 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001006144038.ZWGE22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Fri, 6 Oct 2000 07:40:38 -0700 Message-ID: <39DDE552.25808D1D@cs.uiowa.edu> Date: Fri, 06 Oct 2000 09:44:35 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: dong-jun park Subject: Re: about grading.. References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Fri, 06 Oct 2000 09:44:35 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: dong-jun park Subject: Re: about grading.. Content-Type: text/plain; charset=us-ascii Dong-Jun Park, Thanks for your email. First, you may also take the makeup test. Since you did top 4 on the test, you don't need to if you don't want to. However, if you'd like to improve your grade, you are welcome to take the makeup test. Everyone, in my opinion did poorly, perhaps because the test was just too long. We are having the makeup for that reason. I am following the grading policies, in that I don't curve grades. It is true that according to the policies, I should adjust the grades on the test by throwing out the "bad" questions, ones that most people didn't get, and basing the grades on that. However, this seems to be an unusual case, in that if I followed that policy literally, I would have to throw out all but one or two of the first problems. That seems silly, especially since it's important that everyone understand how to do these basic programming exercises well. This is why I took the very unusual step of having a makeup. I believe it's in everyone's best interest. I appreciate your trying hard on the homeworks. As to whether there is significant cheating going on among others, I'm concerned about the possibility, but so far haven't seen lots of evidence to that effect. I don't agree that the policies make it worthwhile to cheat on the homework. It would be better, if one doesn't want to learn the material and to just try their luck on the tests, to not take the risk of cheating and to simply not hand them in. I believe the policies discourage cheating among anyone who thinks about it rationally. In any case, you don't need to worry about whether others are cheating or not, that's my concern. I'm happy to discuss it more if you like, but I hope that by the time of the makeup everyone will have learned the material better. Gary dong-jun park wrote: > hello! professor leavens. > my name is dong-jun park, and i am in your programming language concept. > i am writing this email because i felt there is a need for discussion for > it. > it can be a mere suggestion or just a whining compaint. > however it ends up.. i just would like to let you know how i feel about it. > first of all, english is not my native language so if anything sounds > 'weird',please forgive me. > > at the beginning of the class, i was eager to go for the class. everything > seemed great. if i remember it correctly, you mentioned that we need to do > homework to learn the stufff even though it consists of such a small > fraction of the total grade. (i think 30% is not small at all. ) > i totally agree with you on that one. personally, i am not a > high-score-homework type student since (1) i usually don't know anyone in > class since i was transferred to here (2) i truly believe if i try hard for > the homeworks then i will do good in the test even though i get poor > homework grade. this is my last semester, and this way of studying worked > perfect for me because all of the classes i have taken did curving grade. > in some sense, i think how you described the class at the beginning of the > class and how the sylabus describes the class are somewhat different. 30% is > not so big..thus we do the hw to learn the stuff.. > but in this case we are not curving. what if one does the homeworks really > hard but gets poor score on the homeworks like 10/30. and since he did it > hard, he get's the very good score on the tests. like 60/70. "even though > one did homework hard to learn the stuff and did alright in the tests, one > still wouldn't get A but C!!. > thus, personally i think this class is somehow making it really worth > cheating for the homework. Frankly, i can't believe how most people got such > a good homework score. Actually, the above case is mine. i really tried hard > for homeworks (though i missed the second one) and got a pretty decent test > score [deleted] ,but my grade is only [deleted] so...somehow, most people did > good > on the homework and bad on the test.. and i got a shot on the homework and > did decent on the test... i am perplexed about who's following your method > here. and i just found out that you are giving a make up test for those who > did bad on the test. ( and most people did good on the homework ) > so what's my suggestion? well, i am not sure about that. i just wanted to > let you know. i am just not sure yet how to deal with this class.. > if you could, please help me out here. > hope everything works fine at last... > > dong-jun park > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > Share information about yourself, create your own public profile at > http://profiles.msn.com.  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Oct 8 15:31:08 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id PAA26264 for ; Sun, 8 Oct 2000 15:31:07 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001008203105.WBJI22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 8 Oct 2000 13:31:05 -0700 Message-ID: <39E0DA78.A7EF5B3@cs.uiowa.edu> Date: Sun, 08 Oct 2000 15:35:04 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: "M. Allen" Subject: Re: solution for test 1 problem 9 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 08 Oct 2000 15:35:04 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: "M. Allen" Subject: Re: solution for test 1 problem 9 Content-Type: text/plain; charset=us-ascii Mark, you wrote: > i know we did problem #9 in class, but we did it close to the end > of the period so i didn't get a chance to get it all written out, ..i was > wondering if you could provide a solution so i can check to see if what i > have now is correct. Do you mean problem 9 on the test? Below is my solution for that. Gary (load-from-lib "sym-exp.scm") (define wrap-sym-exp (lambda (se) (if (sym-exp-symbol? se) (s-list->sym-exp (list se)) (s-list->sym-exp (wrap-s-list (sym-exp->s-list se)))))) (deftype wrap-s-list (-> ((list sym-exp)) (list sym-exp))) (define wrap-s-list (lambda (slst) (map wrap-sym-exp slst)))  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Sun Oct 8 18:52:36 2000 Return-Path: Received: from mail.rdc1.il.home.com (imail@ha1.rdc1.il.home.com [24.2.1.66]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id SAA29401 for ; Sun, 8 Oct 2000 18:52:36 -0500 (CDT) Received: from cs.uiowa.edu ([24.178.151.14]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001008235232.YXJX22669.mail.rdc1.il.home.com@cs.uiowa.edu>; Sun, 8 Oct 2000 16:52:32 -0700 Message-ID: <39E109AE.35C3815F@cs.uiowa.edu> Date: Sun, 08 Oct 2000 18:56:30 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en,de,fr MIME-Version: 1.0 To: Zhen-fang Feng Subject: Re: solution for insert-left-of on the Spring99 ch 1-2 test References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Sun, 08 Oct 2000 18:56:30 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en,de,fr To: Zhen-fang Feng Subject: Re: solution for insert-left-of on the Spring99 ch 1-2 test Content-Type: text/plain; charset=us-ascii Zhen-fang Feng you wrote: > Gary, > > Why I got an error > > Error: Mismatch between types of uses and defining expression for: > insert-left-list > Type of uses : (-> (symbol symbol sym-exp) sym-exp) > Type of defining expression: (-> (symbol symbol sym-exp) (list sym-exp)) > insert-left-list : cannot be typed > > when I coded the insert-left-of by use cons. If I changed "cons" to > "append", the code works fine. I always have trouble with the use of cons > and append when doing the homework. I'm not sure when should I use append. > Can you give me some tips? Thanks. > > (load-quietly-from-lib "sym-exp.scm") > > (deftype insert-left-of (-> (symbol symbol (list sym-exp)) (list > sym-exp))) > (define insert-left-of > (lambda (sym1 sym2 lst) > (if (null? lst) > '() > (cons (insert-left-list sym1 sym2 (car lst)) > (insert-left-of sym1 sym2 (cdr lst)))))) > > (deftype insert-left-list (-> (symbol symbol sym-exp) (list sym-exp))) > (define insert-left-list > (lambda (sym1 sym2 exp) > (if (sym-exp-symbol? exp) > (if (eq? sym2 (sym-exp->symbol exp)) > (list (symbol->sym-exp sym1) exp) > (list exp)) > (insert-left-of sym1 sym2 (sym-exp->s-list exp))))) First, it's a bit confusing to call your helper insert-left-list, since it takes a sym-exp as an argument. I prefer naming procedures after the argument type. But as to your question, the type error you're getting is about the fact that, where you are using insert-left-list, it's in the context of a call to cons. Cons has type (-> (T (list T)) (list T)), and here the type checker matches (list T) against (list sym-exp), and so has to match T and sym-exp. But the result type for insert-left-list is not sym-exp, hence the type error. Did you see the solution I sent you in email? You should use cons to add an element to a list, and append to join two lists. cons : (-> (T (list T)) (list T)) append: (-> ((list T) (list T) ...) (list T)) For example (cons 3 (list 1 2)) ==> (3 1 2) (append (list 3 4) (list 1 2)) ==> (3 4 1 2) So basically it's a type difference. Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Oct 9 10:20:27 2000 Return-Path: Received: from server.divms.uiowa.edu (server.divms.uiowa.edu [128.255.28.165]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id KAA14397 for ; Mon, 9 Oct 2000 10:20:25 -0500 (CDT) Received: from cs.uiowa.edu (dhcp206.divms.uiowa.edu [128.255.28.195]) by server.divms.uiowa.edu with id KAA21613; Mon, 9 Oct 2000 10:20:22 -0500 (CDT) Message-ID: <39E1E288.6D2EA2C1@cs.uiowa.edu> Date: Mon, 09 Oct 2000 10:21:44 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Matthew Philip Shera Subject: Re: Problem 6 on Exam 1, deftype References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 09 Oct 2000 10:21:44 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en To: Matthew Philip Shera Subject: Re: Problem 6 on Exam 1, deftype Content-Type: text/plain; charset=us-ascii Matthew, If you have a deftype like (deftype foo (-> (S T U V) W)) for the non-curried procedure foo, then the curried version, foo-c, would have type (deftype foo-c (-> (S) (-> (T) (-> (U) (-> (V) W))))) You just have a nest of procedure types, with each taking one argument. Gary Matthew Philip Shera wrote: > Hi Gary, > I was wondering if you could help me with the deftype for this problem. > The textbook is sorely lacking in this area and I only have one example > (for the procedure called twice) in my notes. This problem is the one > where we wrote a curried version for average3-c. Thanks. > > Matt -- Gary  1,, X-Coding-System: undecided-unix Mail-from: From leavens@cs.uiowa.edu Mon Oct 9 10:24:06 2000 Return-Path: Received: from server.divms.uiowa.edu (server.divms.uiowa.edu [128.255.28.165]) by css-1.cs.iastate.edu (8.9.0/8.9.0) with ESMTP id KAA14501 for ; Mon, 9 Oct 2000 10:24:05 -0500 (CDT) Received: from cs.uiowa.edu (dhcp206.divms.uiowa.edu [128.255.28.195]) by server.divms.uiowa.edu with id KAA22000; Mon, 9 Oct 2000 10:24:02 -0500 (CDT) Message-ID: <39E1E364.D1A5DF92@cs.uiowa.edu> Date: Mon, 09 Oct 2000 10:25:24 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Matthew Philip Shera Subject: Re: parse trees References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit *** EOOH *** Date: Mon, 09 Oct 2000 10:25:24 -0500 From: "Gary T. Leavens" Reply-To: leavens@cs.uiowa.edu X-Accept-Language: en To: Matthew Philip Shera Subject: Re: parse trees Content-Type: text/plain; charset=us-ascii Matt, A parse tree has as the root node is the nonterminal that you are deriving from (e.g., ) and an arc from each node (nonterminal) to as many nodes as there are in the right hand side of a production. Each of the leaves is a terminal symbol in the grammar, and all the interior nodes are nonterminals. Each subtree represents the expansion according to the production rules of the nonterminal at its root. Gary Matthew Philip Shera wrote: > Hi once again. Could you explain or point me to an explanation of a parse > tree. I can't seem to find an example in the meeting outlines or in my > notes (I think I take pretty decent notes, but maybe not). Thanks > > Matt -- Gary