York University- Department of Computer Science and Engineering

SC/CSE 3401 3.00 – Functional and Logic Programming


Course Director: Vida Movahedi

Lectures: Summer 2010, Wednesdays 19:00-22:00, CLH 110

Office Hours: Mondays, 12:00- 14:00, CSEB 2002

(You can find me in CSEB 0002B at other times)


Course Outline

Unofficial Grades- tentative, unofficial, and subject to change at the Department's or Faculty's request!


On this page:


Course Schedule

Assignments & Solutions


News (latest on top):

·         I had a great time and valuable experience teaching your class. Thank you for the honour. My best wishes for each and every one of you J

·         Your marks for assignments 3 & 4, the final exam, and the overall course are posted. Note that these grades are tentative and unofficial, and subject to change at the department’s request. Solutions to the final exam are also online. If you have any questions or concerns, please email me before Monday August 9, 9:00 AM since I need to submit the marks asap.

·         I have made some corrections to solution of question 3, assignment 4. Thank you, Li De.

·         Solutions to assignment 4 are posted. See you on Tuesday, Aug. 3 at 14:00 for the final exam: www.registrar.yorku.ca

·         I have updated the previous ‘unofficial grades’ page with changes. I am considering adding an optional Logic Programming section to the final exam, only for those who want to improve their mark on the first section. If you want to write this section, you need to email me by July 31st, 11:59pm. The Functional programming questions will be distributed first at 2pm and should take about 2 to 2.5 hours. Then only those who want to write the Logic programming section will stay (for a 30 to 45min exam). By writing this optional exam, you agree to change the weight distribution of the Logic Programming section of your mark which was (Asg1=7%, Asg2=8%, Lab=5%, Test1=30%)  to (Asg1=7%, Asg2=5%, Lab=5%, Test1=18%, Test2=15%) (Not negotiable if you write this optional exam, even if it lowers your mark). Calculate what you must get on this exam in order to improve your overall mark, before committing to it (Not recommended unless you are absolutely sure that you can do MUCH better now compared with midterm exam!). Email me by above deadline if you want to write this section.

·         Assignment 4 is posted and is due on Monday, Aug 2, 2:30pm. Please read the instructions carefully. Check for updates here: notes4

·         First part of assignment 4 is posted so you can start working on it. I will post the finalized version by weekend.

·         Please come for the course evaluations on July 21, at 7pm. It is your turn to evaluate, don’t miss it!

·         Solutions to assignment 3 are posted.

·         Assignment 3 is posted and is due on Monday, July 19, 2:30pm (CSEB2002). Please check for updates here: notes3

·         Unofficial marks of Logic programming are posted. The weights of (Asg1, Asg2, Lab, Test1) are (7%, 8%, 5%, 30%) adding up to 50% of course mark.

·         Unofficial marks and solutions of Test1 are posted.

·         An approximate layout of Test1 on June 23:

o   about 40% concepts and theory of logic programming, understanding search in Prolog

o   about 35% writing code in Prolog

o   about 25% understanding and analyzing code in Prolog

·         Lab practice questions given by Haluk: lab_questions and lab_answers

·         Solutions to assignment 2 are posted.

·         Lab location for Thursday, June 17 is Prism Lab, room CSEB 1002, seats miss 01-10 only. Only those who have a final exam on Wednesday, June 16 and have already emailed me are allowed to use this lab session. Paper version of the assignment is due on June 16th, 7pm for everyone.

·         Lab location for Wednesday, June 16 is Prism Lab, room CSEB 1006. Be there at 7pm to submit both your assignment paper version, and to show your code running. As a reminder, you must have your code ready on your account. No extra time will be given to you to write your code. You will be asked to explain your code and to write queries based on your code. There will also be extra programming assignments for you to work on. You will be marked for this lab session.

·         Tentative date for make-up lab session: Thursday, June 17, 7-10pm. This session is only for those who cannot attend the lab session on June 16th due to a conflicting final exam. Please email me ASAP if you have such a conflict.

·         I have added a link to unofficial grades above.

·         I will add Q&A about assignment 2 here: notes2

·         Some notes about next sessions: notes1

·         Assignment 2 is posted and is due on June 16. You need to (a) submit the answers on paper, (b) show your code running in the lab. Use ISO I/O for question 2 (not Edinburgh edition).

·         Solutions to assignment 1 are posted.

·         For assignment 1, assume right associativity for logical connectives, e.g. p -> q -> r is p -> (q -> r)

·         Please submit your assignment 1 in class on Wednesday. Do not submit question 7, part (c).

·         Assignment 1 is posted (see bottom of page) and is due on May 26.

·         Our class room is changed to CLH 110.

·         First class will be held on May 5, 2010 at 7pm. See you in PSE 321.


Course Schedule (tentative):




May 5, 2010

Course Outline and policies

Introduction to Logic Programming &

Review of Logic

A sample Prolog session

Conjunctive Normal Form and Horn Clauses






May 12, 2010

Introduction to Prolog

Resolution & Refutation



May 19, 2010


Accumulators and Difference Lists



May 26, 2010

Assignment 1 Due

Cut, Not, and Fail



June 2, 2010

Input and Output


June 9, 2010

Example programs

Review of Logic Programming

(Bring your questions!)



June 16, 2010

Assignment 2 Due

Lab session

TA: Haluk Madencioglu


June 23, 2010

Midterm exam

See solutions:


June 30, 2010

Introduction to Lambda Calculus and

Functional Programming

[Ref.: Chap. 1-2 of Lecture Notes on Lambda Calculus by Peter Selinger]



July 7, 2010

Function definition, predicates, conditionals

Recursion and Iteration



July 14, 2010

Property lists

Control over evaluation/ Higher-order functions

Assignment 3 Due (on July 19th@2.30pm)



July 21, 2010

Course Evaluation


More flexible functions




July 28, 2010

More on LISP

Review of Functional Programming

Assignment 4 Due (on Aug 2nd@2.30pm)


(review questions w/o answers: Review_Questions)

August 3, 2010

Final exam, at 2pm





·         Assignment 1 (due May 26): Assignment1

·         Assignment 2 (due June 16): Assignment2

·         Assignment 3 (due July 19): Assignment3

·         Assignment 4 (due Aug 2): Assignment4

o   sample data file for question 3: temp.txt

o   sample submission files: Movahedi_Vida_code.lsp and Movahedi_Vida_dribble.txt



·         Assignment 1- solution: Assignment1_solution

·         Assignment 2- solution: Assignment2_solution

·         Assignment 3- solution: Assignment3_solution

·         Assignment 4- solution: Assignment4_solution

o   Code file and dribble file



·         Test 1- solution: Test1_solution

·         Test 2- solution: Test2_solution