From leavens@larch.cs.iastate.edu Tue Dec 5 10:28:30 2006 Date: Tue, 5 Dec 2006 10:28:30 -0600 (CST) From: Gary T. Leavens To: Chris Cornelison Subject: Re: cs541 - HW7 Hi Chris, On Tue, 5 Dec 2006, Chris Cornelison wrote: > I'm working on problem 2, (Erlang Receive) > > I've read the section 2 or 3 times now, but am still having trouble getting > started. > > The problem defines 3 functions > > C={Mailbox.new} creates a new mailbox C > Is C a port or a stream? It should be a port object I think. > {Mailbox.send C M} > This looks to be the same as {Send P S} for ports. Ok. > {Receive ...} > This should probably do something similar to figure 5.22, I just don't know > where the streams and ports are coming from. They probably should be passed as parameters. > Hopes any of this makes sense. Right now that's about the best I can do for > a constructive question. > > I'm in about the same place with problem 1, but will save for a separate > email if needed. 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 Dec 7 21:46:02 2006 Date: Thu, 7 Dec 2006 21:46:02 -0600 (CST) From: Gary T. Leavens To: msrao@cs.iastate.edu Subject: Re: Untraceable procedure definition Hi Meghana, On Thu, 7 Dec 2006 msrao@cs.iastate.edu wrote: > I am trying to solve problem number 5 in section 5.9 towards the problem 4 of > assignment. I am keen on trying to understand how the authors have implemented > the NewPortClose operation. The book quotes that the procedure definition has > been given in the supplements file of the web page but I failed to find the > same after a lot of looking up. I would appreciate your help with finding the > definition of this function, since I thought you might have already looked it > up on the home page of the book. This supplements file is the one found at: http://www.info.ucl.ac.be/people/PVR/ds/booksuppl.oz This should be put in your ~/.ozrc file, and will thus be automatically read by Mozart when started. The NewPortClose abstraction is found starting on line 89. 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 Dec 7 22:04:29 2006 Date: Thu, 7 Dec 2006 22:04:29 -0600 (CST) From: Gary T. Leavens To: Chris Cornelison Subject: Re: cs541 - HW7 Hi Chris, On Thu, 7 Dec 2006, Chris Cornelison wrote: > In problem 1d, (provide a way to take a lift down for maintenance) > > My basic idea is just to remove the lift from the Lifts variable that each > floor has. I would do this by adding a new message case to the Floor, > something like maint(). Ok. > In an imperative language I would just remove the lift from the list and the > floor's code to randomly select a lift would work as is. > > Doesn't seem like there is an equivalent action in to do this in Oz. What you have to do is change the state that is kept by the Floor objects' state accumulator. This state is the Init argument to NewPortObject and what is returned by the function that is run by the new port object. Returning a new state is equivalent to changing it. > The problem is slightly compounded by the bad design of the existing system, > where each floor has its own list of lifts to choose from. I'm trying to > avoid fixing the existing problems however. > > How do I think about this? You may need to either loop over all floors, or centalize the knowledge. 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 Fri Dec 8 16:23:20 2006 Date: Fri, 8 Dec 2006 16:23:20 -0600 (CST) From: Gary T. Leavens To: "Gulabani, Teena" Subject: Re: Doubt in lift control system Hi Teena, The code in ~/classes/cs541/lectures-vanRoy-Haridi/message-passing/ works for me. This is essentially unchanged from the book. See LiftSystemTest.oz for a test case that does work with it. The error you are getting might be that you typed something in wrong if you typed it in yourself. On Fri, 8 Dec 2006, Gulabani, Teena wrote: > I am trying to solve that lift control system.I started with the rudimentary > example (without making any changes) to the code given in book.I get "missing > else clause" error for floor and lift component. > Are the components specified correct? > Let me know. 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 ---------------------------------------