University of Toronto - Spring 1999
Department of Computer Science

CSC 324 - PROGRAMMING LANGUAGES

Current Announcements


12 May: Marks

Your unofficial final marks have been posted on my door. Thanks for being an absolutely fabulous class -- I had a great time. Keep in touch.

Paul Gries

CSC324 instructor


6 April: New Office Hour Schedule

I have been called away on some urgent department business and so have to cancel my 324 office hours on Wednesday. Please see the main course page for my new office hours.

6 April: retract statement in assignment

Question: When I try and use the retract statment on rules loaded in from a file it fails. According to the xsb manual this is because these statment were compiled.

Is there a way to load a file into xsb without it being compiled ?

The retract statment works when applied to statments entered using assertz.
Answer: I've poked around, and it looks like this is not possible. All it means for this assignment is that you can't modify your original facts. One workaround is to use [user]. and cut and paste, but we don't expect you to actually fix the problem.


5 April: The Last Quiz

The last quiz will be on the difference betwen the various equality items in Prolog -- specifically, what the following three predicates do, and when they can be used:
    =
    
    is

    =:=
In particular, look at slides Data Structures - 3 and 4 -- those define 'is' and '=:=' pretty clearly. Slide Running Prolog - 7 defines '='. Slide Data Structures - 6 shows many uses of the three predicates. Slide List Processing - 9 has a use of '=' when defining the member() predicate, which should provide you with another clue.

3 April: Office hours in the CDF lab

Reminder: our friendly neighbourhood TAs, Peeter and Diana, will be having office hours Sunday 2-4pm and Wednesday 4-7pm, respectively. (In the Annex building.)

30 March: Quiz

The quiz today will ask what happens when our database of facts has this form:
f(a). 
f(b).
f(X).
(Note the capital X.)

30 March: What to hand in

Question: Are we required to produce a hard copy of this assignment or just the electronic submission?
Answer: Please produce a hardcopy of the assignment. To turn it in, bring it to my office by noon on Friday; if I'm not in, slip it under the door.

26 March: sum_pairs

Question: Should sum_pairs([], []) return "yes"?
Answer: Yes.

26 March: row_match

Question: In the specification of row_match(L1, L2), it says that L1 is the row below L2. But in the examples, the second arguments are the rows below the first. Which way shall we follow? Which should be below which?
Answer: That should say that L2 is the row below L1, like in the examples. Sorry about that.

24 March: So where the heck do I hand in question 3?

Question: See the title.
Answer: Bring it to my office, SF 2105. If I am not it, slip it under the door.

23 March: Quick assignment clarification

Question: This question is regarding the 5th part of question #2. When you say "f ( a (W) )" , is the "a" being multiplied by "W"? Thus, would it be correct to say that the most general unifier is: { Z/X, X/f(a(W)), W/b }

(or is "f( a (W) )" a composition?)
Answer: Sorry, it's a composition. I should have used g or h rather than a.


21 March: Horn clauses, q3 extension

Question: I'm a little confused about what exactly a Horn clause is.
Answer: I am getting lots of questions about Horn Clauses. What I will do is give a two-day extension of QUESTION 3 ONLY, so that we can better describe Horn clauses in class. No late days may be used with question 3, although you can still use a late day with questions 1 and 2.

Once again, the new due dates:

 
    Questions 1 and 2: Tuesday evening, 6:10pm. 
    Question 3: Thursday evening, 6:10pm. 
I will announce later how to turn in part 3.

In the meantime, you can read more about Horn Clauses here.

Please read all of them, because we will assume familiarity of those slides in class.


19 March: Skolemization

Question: In the third question of the assignment, it says " Don't do Skolemization.". Then how can we get rid of the existential variables?
Answer: I screwed up, you do need it in some cases. I don't know what I was thinking!

What I will do, so I don't penalize the people who are already done, is accept either version -- just indicate clearly whether you used Skolemization. Spread the word, please.

I encourage everyone to try to figure Skolemization out; it isn't difficult to do, and I will explain the intuition in class.

Here's a brief blurb:

You can eliminate the (there exist sign) by introducing a Skolem constant or 
Skolem function.  This can convert a non-horn into a horn clause. 
 
(1)     (exist y)friend(marsha, y) -- this is non-horn, but can be written as  
        friend(marsha, k) -- this is horn for some Skolem constant k 
         
(2)     (all x)[person(x) -> (exist y) friend(x,y)] (non-horn)can be written as 
        (all x)[person(x) -> friend(x,m(x))] (horn) where m is Skolem function 
         
In (1) No dependency for y 
In (2) y depends on x 
Take a look at last fall's homework for more examples.

18 March: PrologA

The questions on this assignment are similar to an assignment from last fall -- head over to that web page, I think the solution for that assignment is posted.

15 March: Next quiz

The next quiz will be on Lisp garbage collection. That's covered by the Side Effect slides, numbered 5-7.

11 March: Office hour

Marcus will be holding office hours in the CDF lab from 2-4pm on Sunday. Go bug him.

11 March: List

Feel free to use the list function on the next assignment.

7 March: Quiz 6

The next quiz will ask about the particulars of the first 3 slides of the section "Functional Arguments" in the course notes. Note that the whole session should start with
    (setq boo 'cons)

28 February: Lambda expressions

One of you rules lawyers asked the following amusing question about 6B:

Question:

    a) you said we can use helper functions on any of the questions except #9.

    b) 6B asks to replace a call to sum-list by a lambda expression.

    c) What's stopping us from calling sum-list from the lambda expression?  :)

Answer: What's stopping you is your own sense of honour and fair play, of course. :-)

Please do not call SUM-LIST (or any other helper function) from within the lambda expression, or use APPLY.


25 February: 1B Marks

The marks have been updated to include assignment 1B. Please check your marks and email me if you find any errors.

27 February: Lisp reference

Question: I was wondering if you could recommend a good LISP Reference.
Answer: A pretty good one is "Lisp" by Winston and Horn; that's what I'm using. There are several others that are okay, but I forget their names.

23 February: Midterm marks

The midterm marks are now on the web, and the midterms will be return in class tonight. We are not quite done with assignment 1B, though.

22 February: quiz tomorrow

As stated in class, quiz 4 will ask to to identify what happens in two situations in Lisp (ask a friend if you missed class), and also trace a recursive function.

22 February: wellFormed, notWellFormed, etc.

Question: Could you please kindly explain the file wellFormedA.lisp and notWellFormedA.lisp. What I mean is the wellFormedA.lisp file has only working final solutions to the all the question, while the notWellFormedA.lisp file has the all the various version to each question that lead up to the final solution that are place in the wellFormedA.lisp. Is this correct?
Answer: If I parsed your question correctly, your guess is not quite correct. wellFormedA.lisp contains all solutions to the questions that are syntactically correct -- they must not produce any errors when you load the file. notWellFormed.lisp will contain only the code that you couldn't get to compile, and will likely be empty. (And you don't even need to submit it if you got everything working.) The reason for this split is that we will be running your code.

(Note to everyone: if you send me a question it really helps me if you take the time to make sure your question is both clear and grammatically correct. Please phrase your questions carefully.)


15 February: (load "filename")

Question: I'd like to be able to create files of my Lisp programs and to feed them into CL, but I haven't been able to get it to work yet. Is this possible, or do we have to type our programs in each time we want something evaluated using CL?
Answer: Try
    (load "filename")
(The quotes are necessary.)

10 February: Quitting Common Lisp

Question: I have a few questions about lisp on the system. I figured out that I'm supposed to type cl to get common lisp. How do I safely quit the interpreter. If I type quit, it tries to evalute it :)
Answer: Try
    :exit

10 February: Quitting Common Lisp

Question: I have seen emacs talk about lisp-interaction. Is there an interactive lisp under emacs?
Answer: Yep! First, run xemacs. (Not emacs. xemacs was just installed in cdf, and has several nice features that the basic emacs doesn't have.) If you see the "List-Interaction" menu, you're in good shape. If you don't, type the 'Esc' key, then 'x'; this puts you in the minibuffer at the bottom of the screen; it's a place where you can type commands. Now type 'lisp-interaction-mode', and hit 'Return'. Type a Lisp s-expr, such as
    (cons '1 ())
anwhere you want in the main buffer. Place the cursor anywhere within that s-expr, and select Lisp-interaction/Evaluate this defun. You should see the result in the minibuffer.

9 February: Midterm location

You should go to your regular tutorial room to take the midterm.

Back to the csc324 home page.