We've graded the final and assigned final grades for the course. Below you can find you final exam grade and your assigned course grade, indexed by your student ID number. 9320965 98 4.0 8610196 87 4.0 8932820 94 4.0 9424290 87 4.0 9150518 93 4.0 9122597 82 3.9 9328378 84 3.9 8319710 82 3.9 9411596 93 3.8 9227235 92 3.8 9310414 76 3.7 9221150 83 3.7 9226088 85 3.7 9412885 84 3.7 8728688 78 3.6 9434344 70 3.6 9321256 74 3.6 9230404 62 3.6 9213942 84 3.5 9432926 68 3.5 9433157 87 3.4 9223002 81 3.4 8212441 56 3.3 9433763 68 3.3 9224443 74 3.2 9330571 55 3.2 9222140 84 3.1 9221931 78 3.1 9434298 61 3.1 9326377 77 3.1 9340450 85 3.0 9226962 47 2.9 9311303 26 2.8 9411854 47 2.8 9450507 63 2.8 9432935 50 2.7 9332601 32 2.6 9223504 42 2.6 9220224 49 2.5 9331496 62 2.5 9231084 51 2.4 9312854 39 2.2 8724150 0.0 -- Craig
Mime-Version: 1.0 Folks, Just a reminder that the solution to the number hierarchy worksheet I handed out in section is on the web. Enjoy! Matthai
Message-ID:The following may be of interest to some of you if you plan on using CS computing facilities over the summer: -------------------------------------------------------------------- I am trying to organize a group of classmates to study C++ over the summer. I would like to know if currently enrolled students (BUT NOT ENROLLED IN THE SUMMER QUARTER) will have access to 329 and the Pentium lab. Also, several of us currently have an account on the Pentiums as part of being in CSE341 this quarter. Do we need to request a new, non-class affiliated account in order to continue to use the Pentiums past the end of the quarter? Or will our accounts continue to exist? ---------- Forwarded message ---------- Cc: cse341@cs Any student who is currently enrolled (majors) may have access to the PC lab. Accounts are set up as requested by the student. >Also, several of us currently have an account on the Pentiums as part of >being in CSE341 this quarter. Do we need to request a new, non-class >affiliated account in order to continue to use the Pentiums past the end >of the quarter? Or will our accounts continue to exist? Yes, I would like to get a request. The users directories have to be moved to a different file system. The current cse341 are will be deleted at the end of the quarter. -rr -------------------------------------------------------------------- And finally, I include the newsgroup disseminated message regarding setting up accounts in the Pentium lab: Newsgroups: uw-cs.ugrads The PC lab is now available for general use. If you would like an account on these systems send an email request to csl-staff. OS: NT3.5 MS Visual C++ ParcPlace Visual Works (Smalltalk) MATLAB mosaic ftp telnet No file mapping to department hosts as of yet. You can FTP from the NT hosts to others, but not the reverse. There are no MAIL, X or NFS tools as yet. This lab is largely unsupported, in that *you* are expected to use the on-line help (there is a lot of it) to learn NT and the available tools. If you think something is broken, please report it to problems@cs. Priority usage will always go to CSE courses assigned to the lab. Currently, those are CSE341 and CSE576. CSE341 has reserved the lab on certain days and hours. This information is posted outside the lab. Please do not enter the lab during the reserved hours. Otherwise -- the lab is open for your use. Enjoy! Renee -------------------------------------------------------------------- Ciao, David
Mime-Version: 1.0 Folks, Here's the plan for next week (I'll be hanging around Sieg 326 to answer questions and such, at these times): Monday 3:30 -4:30 Wednesday 2:00-3:30 If you can't make either time, and have questions, you can either mail me your question or set up a meeting time by email. Good luck! Matthai
Cc: cse341@cs >>ENROLLED IN THE SUMMER QUARTER) will have access to 329 and the Pentium Any student who is currently enrolled (majors) may have access to the PC lab. Accounts are set up as requested by the student. >Also, several of us currently have an account on the Pentiums as part of >being in CSE341 this quarter. Do we need to request a new, non-class >affiliated account in order to continue to use the Pentiums past the end >of the quarter? Or will our accounts continue to exist? Yes, I would like to get a request. The users directories have to be moved to a different file system. The current cse341 are will be deleted at the end of the quarter. -rr
In friday's lecture, I'll be doing course evaluations. Please bring a #2 pencil to class. Also, please think about any suggestions or comments you want to write down on the yellow sheets, letting me know what things you liked and didn't like about the class. -- Craig
Sender: David RogersIn-Reply-To: <199505291654.JAA16063@klamath.cs.washington.edu> Message-ID: Perhaps I will only muddy the waters, but I'll try to help with another explanation... "Sending to self" is just an extension of the basic premise of OO: the basic unit of computation is a self-aware (in the narrowest of senses) object and the method of computation is that several of these objects get things done by sending messages to each other. Each object then can be thought of as a machine that has a set of responses to a set of stimuli (messages.) A functional collection of these machines is an object-oriented system. When we look inside an object, we sometimes find that it is made up of more than one object. These sub-objects can be enclosed by the object (as slots) or these sub-objects can be part of the heritage of the object (supertypes). Further, an object may exist as a part of a larger, more complex object. In the latter two cases, the concept of "self" refers to all of these objects that are somehow connected to the object in question. The slots are not included in this concept of self. Slots are the parts of an object, whereas inheritance introduces multiple aspects of the whole. As an example of slots, a person has two arms or two eyes. But they don't consider their self to be an eye or an arm. On the other hand, a person may be a father, may have an inner child, or may operate a one-person business. It easy easy to see how they could consider their self to be either a father, a child, or a business in various contexts and in response to different stimuli. When we talk about objects, we are usually referring to "instances" of objects. We can think of the class and method definitions as providing the blueprints for the creation and operation of object--sort of like DNA. An instance of the class is an object that has been created by and operates using these blueprints. For example, let's take an instance of Point-2D. An instance of Point-2D has sub-objects that make up its heritage: i.e. an instance of the class Point. Inside every Point-2D is a Point (struggliing to get out?) But an instance of Point-2D can also be a part of a larger "self". For example it can be part of an instance of Point-3D. True object-oriented languages extend the basic OO premise mentioned above to apply even within an object. An object does not have to know which part of its "self" will respond to a given message that it may send to itself or how it will create this repsonse. It only needs to know that it can send itself one of these messages whenever it needs to in order to respond to a stimulus (message) it has received. So, for example, a Point object has the idea that it is supposed to respond to the message "compute distance-from-origin" by getting a list of coordinates from its "self" and computing the Euclidean distance from the origin implied by these coordinates. The point object doesn't contain these coordinates, so it doesn't know how to directly generate this list, but it knows that the "enumerate coordinates" message is a message that can be understood by either its superclasses or its subclasses. So it knows it can just send the message to its "self", and the appropriate aspect of itself will respond. In this case, it is the subclasses of point that provide subclass-specific versions of the "enumerate coordinates" message. So when Point instance that is part of a Point-2d or a Point-3D instance sends itself this message, it is Point-2D or a Point-3D instance that actually responds with the requested list. A class is a state machine that responds to messages it receives by sending other messages to "itself", where it's "self" is both composed of multiple independent sub-selves AND is a larger entity or self. It can be thought of as a black box, made up of black boxes, and making up an aspect of a larger black box. The messages are sent to the whole, and "caught" and processed by the most appropriate black box (using priority rules such as most specialized first, or left to right order). David On Mon, 29 May 1995, Craig Chambers wrote: > > I understand that the concept of "sending to self" is pretty important in > > OO. However, I don't understand 100% what this really means (even though > > I've been in all lectures!). Can you give a very simple example of this > > concept? > > The invocations (coordinates p) in the abstract point class in lecture is an > example, as are the (account-name a) method invocations in the bank.lisp file. > > -- Craig >
> I understand that the concept of "sending to self" is pretty important in > OO. However, I don't understand 100% what this really means (even though > I've been in all lectures!). Can you give a very simple example of this > concept? The invocations (coordinates p) in the abstract point class in lecture is an example, as are the (account-name a) method invocations in the bank.lisp file. -- Craig
Matthai Philipose
Message-ID:
I understand that the concept of "sending to self" is pretty important in
OO. However, I don't understand 100% what this really means (even though
I've been in all lectures!). Can you give a very simple example of this
concept?
_ _
\ ' ` ' `
\ / \ August Z. Flatby ** Like MA BELL ** \ / \
`-' `-'
azflatby@cs.washington.edu
http://www.cs.washington.edu/homes/azflatby
[esc][meta][alt][ctrl][shift] whazzat spell?
Mime-Version: 1.0 Folks, Don't forget: I have office hours from 1:30 to 2:30... last one before the quiz. Matthai
> For ProtectedChecking: > > Must print-object print all the information of the (linked) savings acct, > or is the acct# good enough? > > > I'd just print the other account in its entirety. Note that this is really easy: just use a ~s argument in the format string, and pass the linked savings account object as the corresponding argument. format will automatically call the savings account's print-object. -- Craig
> Are we going to be responsible for C++, and general Smalltalk questions on > the OO quiz? You'll be responsible for the main concepts in C++, in particular static type checking. -- Craig
> For problem 4: > > We need to link the checking account with an existed savings account. > I am not sure that I am clear with this. > Once linked, how do we make changes in the savings account (deposit, > withdraw, end-of-month) > Do we only do within the ProtectedChecking, or do we do it separately > from the ProtectedChecking and still get the same effect ? The linked savings account should be a separate account object that has its own operations. So the first session below is what I want. -- Craig > > I construct the following session to show the 2 situations I am decribing > above, hope you can answer this. > ( this session, I make it up, I haven't implement the code ) > > 1st session : > > (setf mysav (make-instance 'Savings :balance 1000 :interest-rate .04)) > Savings account #1 : balance $1000 > > (setf myprot (make-instance 'ProtectedChecking :savings mysav :service 10)) > ProtCheck account #2 : balance $0 > > (with-slots (savings) myprot savings) > Savings account #1 : balance $1000 > > (deposit mysav 1000) > Savings account #1 : balance $2000 > > (with-slots (savings) myprot savings) > Savings account #1 : balance $2000 > > ****** > 2nd session : > > (setf mysav (make-instance 'Savings :balance 1000 :interest-rate .04)) > Savings account #1 : balance $1000 > > (setf myprot (make-instance 'ProtectedChecking :savings mysav :service 10)) > ProtCheck account #2 : balance $0 > > (with-slots (savings) myprot savings) > Savings account #1 : balance $1000 > > (deposit_saving myprot 1000) > ProtCheck account #2 : balance $0 > > (with-slots (savings) myprot savings) > Savings account #1 : balance $2000 > > mysav > Savings account #1 : balance $1000 ---> still remain, is not affected. > > Which one do you mean ? > > Or may be none ? It that's so, then how ProtChecking should behave in > term of this linking ? > > > > >
> What would you expect ProtectedChecking to report at the end of the month. > Does it need to also include the information related to its linked savings > account or only its own account information. I would appreciate very much > your clarification. > > Thank you. > > It's OK either way. I just dealt with the ProtectedChecking account reporting, assuming that the linked Savings account was sent its own end-of-month message separately. -- Craig
> Is "dynamic dispatching" another term for "run-time method lookup" ? Yes. Same for "message passing", "sending a message", "virtual function calling", "generic function calling", and probably some others I've forgotten. -- Craig
> In the question 3, I am note quite sure about the behavior of the CD class. > Is it correct that after a maturity period, the CD class will be exactly > like savings accounts (withdraw, get interest every month,...) ? Yes. Not totally realistic, but fine for the purposes of the project. > Also, if the savings is overdrawn, your bank.lisp program will calulate > the negative interest, and add up this amount with the balance, this make > the balance more negative. Is that what you really mean? Again, probably not totally realistic, but OK for the project. > For CD account, is it possible to deposit any time before the CD matures? Yes. > I'm still not sure about the difference between using accessor and > with-slots. > > In the lecture-note you say : Use accessors whenever the slot is in the > external interface of class. What does it mean ? The external interface of the ADT. Recall that ADTs have a set of public operations in their interface, that are to be called by clients. If one of your slots is part of the public interface to your ADT (i.e., class), then using an accessor is convenient. Another good reason to generate accessors is when you might want to allow calls to the accessor to be overridden in subclasses. E.g., in Point2D, you can generate x and y slot accessors, but override those accessor methods in the PolarPoint2D class with methods that compute x and y from rho and theta. > In your bank.lisp, you define some classess (Savings and Checking) and > declare (?) accessor (reader), but in the implementation (defmethod) you > do not use the accessor keyword, instead you use with-slots. > If you are not going to use the accessors to access the slot, why do you > declare it in the first place ? Because for instance I thought that balance was a reasonable operation to allow clients of the classes to call. I was defining a class library for use in other applications, not a self-contained program. Even though I didn't call balance in my original class library, some yet-to-be-implemented client might want to access the balance of an account. I could also reasonably have replaced all my (with-slots (balance) ...) direct slot accesses with invocations of the balance accessor method, too. In this particular case, if you don't expect to be replacing the balance accessor method with something else, it doesn't particularly matter one way or another. > Do we need to implement print-object for each new classes > (CLOS Project, problem 1-4) ? > > In the bank.lisp, both the print-object method in Account Class is used > for both Savings and Checking class. You need to implement enough so that each class prints out in a unique way; you should be able to tell what class an object is and its important slot values from its print-out. Look more closely at the print-object method in Account, if you think it does the same thing for both Savings and Checking. > Regarding part 4: > > 1. If the user attempts to overdraw their checking account, I assume we > assess the service charge to their linked savings, right? Right. > > 2. Do we withdraw from the linked savings only the amount that is needed > to cover the checking withdrawal (thereby leaving the checking account at > $0.00), or do we withdraw the *entire* amount from the linked savings > (thereby leaving the checking account at whatever it was to start with)? > I'm assuming the former. I am too. > Is there any good way to make OO-style helper functions? It seems to me > that if I just do this the standard way, it makes my code > 'function-style'... Is that okay? Is there an alternative 'better' way? > > For example, I'de like to write a helper function called "transfer" which > takes two accounts and transfers maney from one to the other to be used > withen the method 'withdraw' in ProtectedChecking class. It's OK to have regular functions as helpers. Also, many helper functions are really methods on particular objects, which themselves can be overridden. See, for example, the account-name helper function. That's OO-style. -- Craig
cc: cse341@cs In-Reply-To: <199505191720.KAA13326@klamath.cs.washington.edu> Message-ID:I asked Professor Chambers about this, and was told that if I implemented BoundedQueue so that it EITHER printed an error message OR enqueued the item, fine, BUT DOCUMENT THE ASSUMPTION AND DEVIATION! David On Fri, 19 May 1995, Craig Chambers wrote: > > Prof. Chambers, > > For bounded-queue(question#3), I'm not sure how enq is supposed to do when > > the queue is full. Does it still enqueue the element and print out a warning > > message, or it just print out the message and ignore the element ? > > many thanks > > I think this was answered already, but I can't find it now. If the bound > is exceeded, a warning message should be printed, but the enq should be done > anyway. > > -- Craig >
> Do we need a script file showing that our classes/methods/functions > work, or just the classes, etc. themselves? Some simple testing logs would be nice. -- Craig
> I've got print-object working fine for the various queues, using a name > accessor and slot. But in the first question on the assignment, it suggests > that dequeue needs its own version of print-object. Is this really true > if I use a name slot? As far as I can tell, this makes it possible to just > have it use the one which it inherits. In the assignment, I meant that dequeue shouldn't just print out like a queue. If you've arranged things so that this is true, then you're fine. -- Craig
> Prof. Chambers, > For bounded-queue(question#3), I'm not sure how enq is supposed to do when > the queue is full. Does it still enqueue the element and print out a warning > message, or it just print out the message and ignore the element ? > many thanks I think this was answered already, but I can't find it now. If the bound is exceeded, a warning message should be printed, but the enq should be done anyway. -- Craig
(5.65+UW95.05/UW-NDC Revision: 2.32 ) id AA03126; Thu, 18 May 95 18:49:43 -0700 Cc: Dave McPherson, cse341@peony.cs.washington.edu In-Reply-To: <199505190114.SAA05706@peony.cs.washington.edu> Mime-Version: 1.0 May be it's just me, but I don't find it easy to understand what you mean by 'clock on the CLOS link ...' On Thu, 18 May 1995, Matthai Philipose wrote: > Actually, I just meant clock on the CLOS link > under "Section and related material" on the > homepage. > Matthai > > > > > > Maby It's me but I can't find a section/CLOS link in the course web. > > > > On Thu, 18 May 1995, Matthai Philipose wrote: > > > > > Folks, > > > I've placed the solutions to the problems from section > > > on the web (section/CLOS off the home page). > > > > > > > -Dave > > > >
(5.65+UW95.05/UW-NDC Revision: 2.32 ) id AA03126; Thu, 18 May 95 18:49:43 -0700 Cc: Dave McPherson, cse341@peony.cs.washington.edu In-Reply-To: <199505190114.SAA05706@peony.cs.washington.edu> Mime-Version: 1.0 May be it's just me, but I don't find it easy to understand what you mean by 'clock on the CLOS link ...' On Thu, 18 May 1995, Matthai Philipose wrote: > Actually, I just meant clock on the CLOS link > under "Section and related material" on the > homepage. > Matthai > > > > > > Maby It's me but I can't find a section/CLOS link in the course web. > > > > On Thu, 18 May 1995, Matthai Philipose wrote: > > > > > Folks, > > > I've placed the solutions to the problems from section > > > on the web (section/CLOS off the home page). > > > > > > > -Dave > > > >
cc: cse341@peony.cs.washington.edu Mime-Version: 1.0 Actually, I just meant clock on the CLOS link under "Section and related material" on the homepage. Matthai > > Maby It's me but I can't find a section/CLOS link in the course web. > > On Thu, 18 May 1995, Matthai Philipose wrote: > > > Folks, > > I've placed the solutions to the problems from section > > on the web (section/CLOS off the home page). > > > > -Dave >
> If you haven't done so already, would you mind posting the revised > schedule? I'd really appreciate it. My current plans are to hand out the project assignment tomorrow, have it due the following Friday, and have the OO test on the following Tuesday (after Memorial Day holiday on that Monday). As usual, all such plans are subject to change, but I think this schedule will hold up. -- Craig
Mime-Version: 1.0 Folks, I've placed the solutions to the problems from section on the web (section/CLOS off the home page). Enjoy! Matthai
> Should enq-all recursively enq each element? If so how do I use recursion > and basecases with obj-oriented programming. enq-all should be a regular function, implemented in a regular recursive Lisp style, that sends the enq message at each recursive call. -- Craig
Mime-Version: 1.0 Folks, If you're having trouble with print-object, I high recommend going through the recent mail to the class mailing list (remember it's archived on the web and accessible from the class home page) from Craig and me: a whole bunch of questions is answered there. Matthai
Mime-Version: 1.0
Here's a transcript of my responses to queries on print-object by an
irate student: hope it helps all of you :-)...
Matthai
----------------------
> I don't understand the print-object portion of the assignment.
> What the hell is it and how the hell does it work? Nowhere in the notes
> or book? can I find anything that helps me at all with print-object.
*****************************
Page 12 of the handout "CLOS constructs"
talks about print-object
***************************
Here's a rephrasing:
Suppose you say
user[1] (setf x '(1 2 3 4 5 6))
(1 2 3 4)
And you now say
user[2] (cons x x)
The interpreter replies:
(1 2 3 4 5 6 1 2 3 4 ...)
The question is, how does the interpreter know how
to print out a list? Also, how does it know to put
the dots after ten elements?
The answer is (I'm lying here a bit) that the person who defined the list
data structure gave the list interpreter a method
to print the list object. It probably went something like
(print-object ((l list) stream)
(format "(");
;;(format the first 10 elts of the list)
;;if there are more than 10 elts, format the ...
(format ")"))
When a lisp interpreter wants to print an object of class foo(say),
it automagically looks for a print-object method starting:
(print-object ((obj foo) stream)
.....
)
which determines how the object should print out.
> am done with the HW, but can't figure out print-object. Part of my
> problem with print-object is format. What the heck does ~s do? And what
> about ~%?
format is covered pretty well in the textbook... we even used it in
the LISP part of the course. I strongly recommend you take
a good look at format in the book: it's essential for understanding what
print-object does.
>Also, what about stream? Since I can't figure out
> what stream and print-object and format with ~s do, I can't test the
> print-object portion. What the heck do I pass to print-object for the
> stream argument if I want to test the method to see if it works?
From the first part above, it should be clear that print-object
will be called automatically for you. Once you have written print-object,
all you have to do is say something like:
USER[1] (setf foo (enq-all '(1 2 3) (make-instance 'queue)))
and then..
USER[2] foo
This should give back to you the printed representation of the queue
above.
Hope this helps.
Matthai
> I want to be sure I understand this your way--or find out if it is ok > if my symantics are slightly different. > > I think of a queue as inserting at the rear (end) and being serviced from > the front. It sounds like your earlier email is saying that we should do > the reverse. > > Since this will be a source of confusion as I code, can I either: > > 1) adopt my symantics or > 2) change the names of "enq" and "deq" to "enq-front" and "deq-end" to > remind me of your symantics and differentiate them from "enq-end" and > "deq-front"? > > David It's OK with me if you rename enq-end and deq-front to be the other way around, if that fits your mental model better and you comment the change. Don't rename enq and deq, though. -- Craig
> I am trying to do print object but I don't understand why I have to > have two variables q & stream. Stream does nothing with the > code, but the compiler wants that in there to fill some generic. > So to print I have to type > > (print-object q1 nil) > > or > > (print-object q1 '(foo bar blah)) > > WHY? You shouldn't be calling print-object directly. You should let CLOS do it, e.g. by evaluating a queue at the read-eval-print loop. CLOS will provide the right output stream for you. > > > > > > (defmethod print-object ((q queue) stream) > (with-slots (slot1) q (format nil "The queue contains ~s" slot1))) > (defmethod print-object ((q dequeue) stream) > (with-slots (slot1) q (format nil "The dequeue contains ~s" slot1))) The stream argument should be passed as the first argument to format. Not nil. -- Craig
> I can't generate or find a working example of print-object. For instance, > I tried: > > (defclass Rectangle () > ( (center :initform 0) (width :initform 0) (height :initform 0))) > > (defclass ColoredRectangle (Rectangle) ((color :initform 255))) > > (defmethod print-object ((r Rectangle) stream) > (with-slots (center height width) (format stream "Rectangle ~sX~s at ~s~%" > width height center))) > > > (setf r (make-instance 'Rectangle)) > > (setf cr (make-instance 'ColoredRectangle)) > > > Entering "r" or "cr" at the read-eval-print loop gives me "unprintable > object. Could I please have a single working example of defining and using > "print-object"? Ah, you've found a typo in my slides. In print-object, the with-slots is missing the "r" argument after the list of slots. I.e.: (defmethod print-object ((r Rectangle) stream) (with-slots (center height width) r (format stream "Rectangle ~sX~s at ~s~%" width height center))) -- Craig
> From joeh@wolf Thu May 18 00:33:22 1995 > Date: Wed, 17 May 1995 17:33:18 -0700 (PDT) > From: Joseph Heitzeberg> Subject: Re: HW > To: Craig Chambers > MIME-Version: 1.0 > Content-Type> : > TEXT/PLAIN> ; > charset=US-ASCII> > > > With enough foresight, you probably could set things up to inherit much of > > the print-object code. For example, you could define a method queue-name > > that is implemented in each kind of queue to return a string name for the kind > > of queue. Then print-object would send queue-name to itself to find out the > > name to use in the print-out. This is an application of the idea of inserting > > sends to self to achieve additional flexibility & reusability of code. > > > 1 If you did that, wouldn't it end up just using the queue-name method for > the class that print-object is in? For example, even though a method > queue-name is defined in the subclass, when print-object needs to be > called, it doesn't exist so the super-class version is used, and it > invokes the queue-name of its class. You have to reimplement queue-name for each subclass, but there's no/less redundancy for queue-name than for print-object. Essentially, you're parameterizing print-object for the parts of the printing that definitely change from class to class. > > 2 When you say "send queue-name to itself" what exactly do you mean? (defmethod print-object ((q queue) stream) ... (queue-name q) ...) In Smalltalk, the specialized formal parameter is always called "self"; I sometimes slip into that common OO lingo. "Send a message to itself" should be a phrase you understand, though, even in CLOS; each OO language has some way of doing this critical operation. > > > 3 Does "send a message" correspond to "call a method"? Yes. "Call a virtual function" (in C++) is another synonym. Note, however, that "call" is a bit misleading, since the "call" involves a run-time method lookup; the caller doesn't know exactly what method will be invoked, unlike a regular procedure call. "Send a message" makes it clear that it's not just a regular procedure call. I wish OO languages used a common set of terms, rather than each making up its own. But I can't change reality. -- Craig
Context: I'd like to inherit print-object in subclasses, but I don't want bounded queues to print out with "queue" as the type. Do I have to rewrite print-object for each subclass? > Prof. Chambers, > > Im sorry! I didn't see the line in the HW where you specified that > each subclass should have its own version of print-object. I assume this > means re-write the whole thing... > > Still, I get the idea that this "handy little method" should not use > inheritance even though it could... Is this right?* > > *page 12, CLOS handout. With enough foresight, you probably could set things up to inherit much of the print-object code. For example, you could define a method queue-name that is implemented in each kind of queue to return a string name for the kind of queue. Then print-object would send queue-name to itself to find out the name to use in the print-out. This is an application of the idea of inserting sends to self to achieve additional flexibility & reusability of code. -- Craig
> In the handout about CLOS construct you say on the last page that the > else clause in an if can have several expressions. How is this done? I > only get a warning like > > IF only accepts three arguments, you are using 4. > It is true that some Common Lisps support this, but it is not > truly legal Common Lisp. For now, this code walker is interpreting > the extra arguments as extra else clauses. Even if this is what > you intended, you should fix your source code. > > So, the only way I could get around this was to use the progn special > form, like this: > > (defun print-object-helper (lst stream) > (if (equal (length lst) 1) (format stream "~s." (first lst)) ; last el. > (progn ; *** two clauses in else... > (format stream "~s, " (first lst)) > (print-object-helper (rest lst) stream)))) > > This seems to be pretty general, the interpreter also complains when I > try the code snippet on page 13 of the handout: > > [3] USER(6): (if (> i j) > (progn > (setf i (+ i 1)) > (setf j (- j 1)) > (+ i j)) > (setf i (- i 1)) > (setf j (+ j 1)) > (- i j)) > Error: malformed if statement > [condition type: PROGRAM-ERROR] > > A. > Yes, you're right. I tried this out after I'd made 45 copies of the handout and found the bug myself. I updated the on-line version of the handout (to correctly indicate that both the then and else branch of an if must be a single expression, not a statement list), but I didn't bother to recopy all the handouts. Sorry for not warning you of this bug sooner. -- Craig
> Dear Craig, > > can you give a specification what is double ended queue is ? > and also the enq-end and deq-front method ? > > P.S. : I was thinking that double ended queue is just like queue but > it allow us to push and pop elements from both ends. Yes, this is right. > > If that's so, why it is enq-end and deq-front, not enq-front > deq-front ? Cause the enq method in the queue class push element > from the end and dequeue element from the front. To me, enq is shorthand for enq-front, and deq is shorthand for deq-end. To add the other two cases, you add enq-end and deq-front. Viola, a double-ended queue. Sorry about the potential confusion of which end of the queue is enqueued. > > thank's > -- Craig
> Prof. Chambers, > > Should 'enq' return the queue object? This seems like a reasonable result, but I'm not particular. > > Should 'deq' return just the object removed from the queue object? Or > should it return the queue object (no of course having one element less)? deq should return the dequeued value. -- Craig
> Some questions on the specs. Am I correct in assuming that 'enq' pushs > an element onto our queue and 'deq' pops an element off of our queue? Yes, assuming by "pop" you mean remove from the end. Remember that queues are FIFO while stacks are LIFO. Don't implement a stack! -- Craig
Mime-Version: 1.0 Folks, I've put the solutions to today's questions on the web: look in section/prolog. Matthai
I've reinstalled the std.prolog file, to fix a typo in my reverted version of difference. -- Craig
> In part 5, I have a small helper relation which I have written as shown > below (Matthai: we discussed this possibility in office hour): > > [main code deleted....] > if(Price1 =< Price2,Cheaper = Trip1,Cheaper = Trip2). > > It seems a little strange to me that I can just throw those goals in as > arguments to if - I guess there is just a simple unification of these > args with the formal variables in the if relation. I hadn't really > realized I could do this. Is there a better of more correct way to > write this? Using "if" is a reasonable way to do this. You also can define another helper function that has two clauses: one whose first subgoal is Price1 =< Price2, one whose first subgoal is Price1 > Price2. Note that "if", like "not" and "setof", is a higher-order predicate: it takes two goals as argument expressions. Like "not", the implementation of "if" 'calls' either its then or its else argument. The call primitive is implicit; just mentioning the then or else argument variable as a subgoal serves to call it. -- Craig
> I don't know -- isn't the first version more powerful than the > symmetric one? Also, isn't it more in agreement with standard set theory? > Third, doesn't it (the first) already do what you want? and 4) > Wouldn't a symmetric version simply be a euphemism for union minus > intersection? (You got it -- I prefer the old one.) Due to overwhelming demand, I've created two versions of difference: the original non-symmetric version and the new symmetric version. Take your pick. [I don't want to take a stand on which is more powerful or more in agreement with set theory.] -- Craig
> It appears that the relation, > > difference(S1,S2,Diff) > > in std.prolog is not symmetric. > > That is, S1 must be a superset of S2. Any element in S2 that is not in > S1 will *not* be included as a 'difference' element in Diff; even > though, by definition, it should be. > > Is this a constraint that you had mentioned before, or is my observation > off the mark? Yes, you're right. I've fixed difference to be symmetric to be symmetric, and installed a new std.prolog file. Thanks for point out this subtle bug. -- Craig
Mime-Version: 1.0 ------- Forwarded Message Hi, I forgot how to load files into prolog (not qui). Could you remind me please? Thanks ------- End of Forwarded Message Use consult(File) ... if you don't want old definitions to be clobbered; reconsult(File) ... if you want old defs to be replaced by newer ones. Matthai
> for the round-trip relation, I understand that the route for going back > can be different from the route it takes from Start to Destination. > > To make it clear, this is an example of what my modification do : > > > | ?- round_trip(seattle, ny, Trip). > > Trip = [seattle,sf,la,ny,london,seattle] ; > > Trip = [seattle,sf,la,ny,paris,london,seattle] ; > > Trip = [seattle,sf,ny,london,seattle] ; > > Trip = [seattle,sf,ny,paris,london,seattle] ; > > Trip = [seattle,sf,ny,la,seattle] ; > > ... and more. > > (*) But in the answers there is no list such that ( for example : ) > > Trip = [seattle, sf, ny, sf, seattle]. > > Trip = [seattle, sf, la, ny, sf, seattle]. > > in which the round_trip gives us a list of cities from Start to > Destination ( no duplicates ), but on the way back, there may be some > cities revisited. > > Which behaviour you want to be in our modification ? > the one that my modification does, or with addition of (*) ? > > thank's > I want people to use some reasonable intuition about what a round trip is. If you call up a travel agent and ask for a round trip to some city, what constraints would you place? It seems clear to me that you wouldn't mind your return trip going through the same cities as the outgoing trip. Nor would you mind going to different cities (that often happens in real life, due to timing of flights and availability of seats). So it's clear that the solutions marked (*) above should be allowed. The only kinds of round trips that don't make sense are ones that visit some intermediate city more than once along either the outgoing or the return path. So, please think about the project questions as real-life tasks, and I think there'll be a lot less confusion about what kinds of solutions are desired. I also think that a careful reading of the problem statement would have answered this particular question, too. -- Craig
Mime-Version: 1.0 Folks, I _strongly_ recommend you skin through the help facility (button on the top right hand corner of the main window) in qui: it outlines lots of things that will make life easier for you (like how to access your previous queries,i.e. avoid retyping them, etc). Spending a few minutes going through this is well worth it. Matthai
It's confirmed: we'll have a surprise guest lecturer next Wednesday. -- Craig
Message-ID:-- Aaron Salter | NEWTON'S LITTLE-KNOWN SEVENTH LAW: | A bird in the hand is safer than one overhead asalter@cs. | FETT'S LAW OF THE LAB: washington.edu | Never replicate a successful experiment ----------------------------------------------------------------------- ---------- Forwarded message ---------- Newgroups: uw-cs.bboard >: >Several of the cs courses rely on materials that are available only in >: >Postscript format. I would like to be able to display and/or print these > >: 1) Locate Ghostscript for Windows > >If your still looking for Ghostscript for windows, I was just on the hunt >for it myself. You can find it at: >gatekeeper.dec.com:/pub/micro/msdos/win3/util/gs261exe.zip An apparently little known fact is that the current version of Ghostscript is 3.12. I recently scoured the planet looking for something other than 2.61 and found it at: ftp.cs.wisc.edu:pub/ghost It now goes by the name Alladin Ghostscript as it is now developed by a spinoff corporation. However, it is still distributed as full source under the GNU Terms. Notable advantage of 3.x is that a Win32 version is available which I don't believe is true of 2.61. So don't trust those PC or GNU archives...they are behind the times... --Eric
Message-ID:Just some stuff I polled off the bboard awhile back ... All three of these mails are different. -- Aaron -- Aaron Salter | NEWTON'S LITTLE-KNOWN SEVENTH LAW: | A bird in the hand is safer than one overhead asalter@cs. | FETT'S LAW OF THE LAB: washington.edu | Never replicate a successful experiment ----------------------------------------------------------------------- ---------- Forwarded message ---------- Newgroups: uw-cs.bboard >Several of the cs courses rely on materials that are available only in >Postscript format. I would like to be able to display and/or print these >materials at home on an IBM PC. I have heard that there is a program called >Ghostscript that will do this. > >I would like to hear from anyone who can point me to information on how to >get this program and on how to operate it. I will summarize responses. > >And if anyone has information on using mosaic from home on an IBM PC >to view course webs instead of the lynx/kermit/ghostscript kludge that I am >"looking forward to", please let me know. > Thanks to all for the information received on "Postscript emulation for the PC" or "Better living through graphical viewers on the PC". The three options suggested were: 1) Locate Ghostscript for Windows 2) Use one of several methods for getting mosaic or mosaic-like programs to run in a PC environment. 3) Install Linux. Please note that the TIA approach has a host machine component, and should not be installed without going through Renee. .ms may have it installed now, but they were ready to de-instantiate anyone who used it last time I heard about it in December since it was suspected of causing crashes. None of these options sound like a lot of fun. One hopes that PPP or SLIP or something is coming from the dept. or C&C that will allow a student access to WWW (which is becoming the standard way for profs. to communicate with students in the dept., it seems) without a minor in UNIX. -------------------------------------------------------------- 1) Locate Ghostscript for Windows (ftp site below) -------------------------------------------------------------- Aaron Salter writes: I also ran across, at one point, a ghostscript for Windows. I think its at either: ftp.ncsa.uiuc.edu (NCSA. Check the /PC subdir) or at: marketplace.com (an ftp site, check in /tia/steve) -------------------------------------------------------------- -------------------------------------------------------------- 2) Use one of several methods for getting mosaic or mosaic-like programs to run in a PC environment. -------------------------------------------------------------- Aaron Salter writes: I just finished setting up my mosaic-over-a-phone-line system, and it works (more or less) just fine. In lieu of a slip line, check out The Internet Adapter (TIA), a SLIP-emulation thing that'll run in your user account. This is what I use. I'll forward you an info document to get you started. Incidentally, TIA is already installed on all .ms machines. -------------------------------------------------------------- -------------------------------------------------------------- Andrew Enfield writes: This probably isn't a solution to the ghostview problem because I don't think this program can display postscript files either. Nonetheless, you still might find this somewhat interesting. The following was posted to comp.newprod about a month and a half ago. I downloaded it and it works ok but is pretty slow (even with a 14.4 modem). Hope this helps out in some way. SlipKnot (tm) is a graphical World Wide Web browser (similar to Mosaic) for Microsoft Windows users with dial-up UNIX shell accounts. MicroMind, Inc. released version 1.0 on November 22, 1994. Its primary feature is that it does NOT require SLIP or PPP or TCP/IP services in any form (no TIA, no remsock, etc.). It uses the user's ordinary dial-up UNIX shell account to retrieve and then paint WWW documents (including, of course, pictures and sound). Description ======================================== SlipKnot offers a terminal window (with vt100 emulation) into your UNIX session, allowing you to use your normal UNIX commands for mail, news, gopher, etc. at any time (except during retrieval of WWW documents). At the press of a button, SlipKnot turns into a graphical WWW browser: 1. Up to 5 document windows available simultaneously. 2. Background retrieval of documents from the Internet, while users can scroll through previously retrieved documents. 3. Ability to save entire documents (including the embedded pictures) into user-definable folders. 4. Ability to demonstrate the WWW offline (displaying the saved documents with their links to each other). Availability ============================================ Check at your service provider first to see if it's available locally. If not, it's downloadable by anonymous FTP sites (approx. 1.2 MB) from: ftp://oak.oakland.edu/SimTel/win3/internet/slnot100.zip ftp://ftp.netcom.com/pub/pbrooks/slipknot/slnot100.zip After downloading, please read the READ.ME file. Price =================================================== Restricted shareware (approx. 3 months evaluation time, depending upon use): US$29.95 for commercial users, and individuals in the U.S., Canada, Western Europe and Japan. US$20.00 for individuals elsewhere. (10% of registration fees donated to refugee relief). Requirements ============================================== 1. Windows 3.1+ running in 386 Enhanced mode (does not support 286 machines), Windows for Workgroups 2. At least 4 MB of RAM (8 MB is recommended) 3. Modem and a dial-up subscription to a UNIX-based Internet service provider with shell account access (must have access to a shell prompt, not a menu-based-only UNIX system) (send e-mail for more...) Limitations (truth in advertising) ===================== 1. SlipKnot will not process "forms" within documents yet (it is an HTML 1.0 browser). 2. SlipKnot will not process "authentication" yet. 3. SlipKnot understands the HTTP and FTP protocols only, no gopher, WAIS, mailto, or news yet (although all of these are readily available in SlipKnot's Terminal window into your UNIX session). 4. SlipKnot is currently available only for Windows-based computers. For more information ====================================== Point your WWW browser (lynx is fine) to http://interport.net/~pbrooks/slipknot.html or send a blank email message to: slipknot@micromind.com Press and distribution inquiries to: Felix Kramer fax 212/866-5527 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Felix Kramer/Kramer Communications NYC-based electronic publishing & journalism Online promotion & marketing e-mail: felixk@panix.com or felixkramr@aol.com voice: 212/866-4864 fax: 212/866-5527 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -------------------------------------------------------------- -------------------------------------------------------------- 3) Install Linux. -------------------------------------------------------------- Ricardo Pincheira writes: If you have the disk space (probably 200 or so for "deluxe" system with X, tons of utilities, the gnu compilers, swap partition, and 60 odd Mbytes for user files , and with IDE disks now at about 50c/Mbyte, why not?), you may consider installing Linux on your pc, a freely-available unix which you will be very hard pressed to distinguish from the unix on the decstations. You can run the X on it, etc. One way you can then use mosaic (or any X aplication) and have the output come out in your machine at home is through a program call "term", which redirects the connection to the X server over the modem to the X server in your machine. It works very well. Oh, of course, you can still boot your dos stuff if you install linux. Anyways, ftp to sunsite.unc.edu: pub/Linux/distributions/slackware (or some such path) for the distribution. Ricardo pinch@cs --------------------------------------------------------------