From leavens@larch.cs.iastate.edu Thu Jan 26 23:06:20 2006 Date: Thu, 26 Jan 2006 23:06:20 -0600 (CST) From: Gary T. Leavens To: gqiu@cs.iastate.edu Subject: Re: 1st exam Hi Grace, On Thu, 26 Jan 2006 gqiu@cs.iastate.edu wrote: > I just wanted to make sure. For the first exam, we are not allowed to bring any > sort of notes to the exam, correct? But for the rest of the 3 exams (including > the final exam), we are allowed to bring 1 sheet of notes, provided that they > meet the requirements stated on the Exams page? Yes, that is exactly right. 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@cs.iastate.edu Mon Jan 30 14:55:05 2006 Date: Mon, 30 Jan 2006 14:55:03 -0600 (CST) From: Gary T. Leavens To: Corey J Mitchell Cc: cs342s@cs.iastate.edu Subject: Re: hw2 5,6 Hi Corey, On Mon, 30 Jan 2006, Corey J Mitchell wrote: > I'm not totally sure I understand how to do 5 and 6. By follow the grammar, > do you mean: > check for null, if null, return empty list > else, do something to the car of the list, then call the procedure with the > cdr of the list > > And if so, if it doesn't do all of those steps, it doesn't follow the > grammar? That's mostly right, but you don't always return an empty list when the argument you are recursing on is null (consider a procedure that finds the length of a list). Also, typically one has to combine the result from working on the car of the list with the recursive call on the cdr. There's a precise definition in the "Following the Grammar" handout, which is also at: http://www.cs.iastate.edu/~leavens/ComS342/docs/follow-grammar.pdf See especially section 5 of that handout. 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 Tue Jan 31 10:12:35 2006 Date: Tue, 31 Jan 2006 10:12:35 -0600 (CST) From: Gary T. Leavens To: eibwen@cs.iastate.edu Cc: Com S 342 TAs -- Kewei Tu , Ru He Subject: Re: COMS 342: HW2 Hi Greg, On Tue, 31 Jan 2006 eibwen@cs.iastate.edu wrote: > I'm having the problem that i have no clue > what questions 3-4 are asking, not sure if i missed something in class or > what, > but i just don't understand the questions at all. The sections listed before > the questions i do not see how they relate at all to teh question: > specific questions as best as i can ask right now: > #3: i used 'and' once in my procedure for homework 1, is that the kind of > thing > you want, how are we not supposed to use #t and #f?, you still want it to > return either #t or #f I mean that your code should not contain the literals #t and #f. Of course, the code will return one of these. If you missed lecture on Thursday, where we explained this, you should look at the lecture notes: http://www.cs.iastate.edu/~cs342/lectures/syntax-abstraction/logical-connectives.txt In essence, the desugarings (or ) = #f (or e1 e2 ...) = (if e1 #t (or e2 ...)) (and ) = #t (and e1 e2 ...) = (if e1 (and e2 ...) #f) say that when you see code like (if E1 #t E2) you can rewrite it as (or E1 E2) and when you see code like: (if E1 E2 #f) you can rewrite it as (and E1 E2) > #4: what section heading explaines this the best? I think the one from the SICP book. STRUCTURE AND INTERPRETATION OF COMPUTER PROGRAMS, SECTIONS 1.1.6 (http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1.6) > I'm also having some trouble understanding what following the grammer is from > the follow-grammar.pdf, could you maybe rephrase it or point me to the exact > part that explaines it best in that for me to reread? the Definition 1.1 i'm > not understanding i don't believe, if thats what you would refer to, what is > "a context-free grammar, G" For this homework, section 5.1 is the most helpful. It gives lots of examples. See also the code examples page on the web. > i found on the Q and A section a email of yours refering to > '$PUB/docs/follow-grammar-flat.txt' which seems to be gone now, replaced by > the > pdf? Yes, the PDF replaces it. > for this part, i'm going to give my mind a bit of rest, then come back to > reading the pdf and hopefully will be able to figure it out. Ok 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 Thu Feb 2 00:00:00 2006 Date: Thu, 2 Feb 2006 00:00:00 -0600 (CST) From: Gary T. Leavens To: cshinatr@cs.iastate.edu Cc: Com S 342 TAs -- Kewei Tu , Ru He Subject: Re: COMS 342 question Hi Chontichar, On Wed, 1 Feb 2006 cshinatr@cs.iastate.edu wrote: > Hello, > I have a quick question for you from old exam, Spring 05 > > Question 1 (1) Numeric data, with operations such as addition, subtraction, etc. > > > The TA said the answer is computation but I still think it's combination since i > think it means something like (+ 3 4) which is combination, isn't it? > > Can you please clarify this confusion. The syntactic form, (+ 3 4) combines the + operation and the two expressions 3 and 4, and is a combination. However the + operation itself is a means of computation. You need both, the + operation and the syntax for calling it in a language. Numeric data and its operations provide a means of computation. The language feature of procedure calls (applications, or combinations) provides a means of combining such data together to do some work. 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 Thu Feb 2 07:50:40 2006 Date: Thu, 2 Feb 2006 07:50:40 -0600 (CST) From: Gary T. Leavens To: cshinatr@cs.iastate.edu Cc: Com S 342 TAs -- Kewei Tu , Ru He Subject: Re: COMS 342 question Hi Chontichar, On Thu, 2 Feb 2006 cshinatr@cs.iastate.edu wrote: > Thanks for your fast clarification. However, I have a few questions for you. > OK. > I still trying to figure out what are the difference between Simplicity and > Generality for the design goals. For example, in Fall 2001 exam question 4, it > asks which goals influenced the syntax like (+ 3 (* 4 2)). How do I know which > goals? I think the main goal influencing that kind of syntax is simplicity, because not having a distinction between infix and prefix operations is simpler than having such a distinction. This doesn't follow from generality, because one would still be able to program everything with a distinction between infix and prefix operations. I think the way to figure out such goals is to imagine changing the future in the most straightforward way, or changing it towards more "normal" languages, and then seeing which of these principles is violated most in that change. Another way of looking at this is to say which principle did we use most in coming up with this difference from normal languages? Hope that helps... 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 -----------------------------------------