COMP348 Tutorial Notes
Principles of Programming Languages - Concordia University


Tutorial Leader Section AA-AE @ H903 Mo--We---- 13:15-14:05

List of tutorials

  1. Tutorial 1 - Prolog - Introduction & knowledge bases
  2. Tutorial 2 - Prolog - Recursion and Lists
  3. Tutorial 3 - Prolog - Recursion with lists and auxiliary functions
  4. Tutorial 4 - Prolog - Lists in Depth part 2
  5. Tutorial 5 - Lisp - Recursion in Lisp
  6. Tutorial 6 - Lisp | Prolog - Abstract Data Types and the Queue ADT
  7. Tutorial 7 - Lisp | Prolog - Set ADT
  8. BONUS * Clisp in the school computers *
  9. Tutorial 8 - Mergesort in Prolog
  10. Tutorial 9 - Quicksort in Prolog
  11. Tutorial 10 - C Programming
  12. Extra swag - scanned handouts from Professor Taleb (c. 2014)

Remember to fill out the TA/Lab instructor online evaluations

Extra swag - scanned handouts from Professor Taleb (19 June 2018)

  1. COMP348_Handout_01_Prolog_Handout.pdf
  2. COMP348_Handout_02_Lisp_Part01-Introduction.pdf
  3. COMP348_Handout_03_Lisp_Part02_Structures.pdf
  4. COMP348_Handout_04_Lisp_Part03_OOP-ADT.pdf
  5. COMP348_Handout_05-Trees.pdf
  6. COMP348_Handout_06-Ruby.pdf
  7. COMP348_Handout_07-C-Language.pdf
  8. COMP348_Handout_08-ADT_in_C.pdf

Tutorial 12 (18 June 2018)

Prolog Revisited

We designed a program to count the number of occurrences (Count) of Elem in a List... There are two ways to accomplish this,

  1. Using an auxiliary Tail-recursive method and parameter copy on the base case
  2. Using a non-Tail-recursive method and accumulating when we leave recursion
The file we created is Count Member in Prolog

C Online resources

Tutorial 10 (11 June 2018)

C Programming

Lesson plan.

  1. Compiling programs
  2. Command line arguments
  3. Use of malloc

Files:

Tutorial 9 (06 June 2018)

Quicksort in Prolog

Files:

Tutorial 8 (04 June 2018)

Mergesort in Prolog

We came up with two separate analogue functions that can "unzip" a list into two, that can interleave two intermediate lists and finally an implementation that leverages these two functions into code that is elegant and easy to understand.

Files:

Bonus (31 May 2018)

Getting Clisp on the school computers.

I have compiled clisp on a school machine and posted the tar with the executable and necessary files in this link.. You have to download it using the browser then navigate to your Downloads folder in your HOME, then tar -xvf clisp-exec.tar to extract it, navigate again into clisp-exec/ then just type source setenv-clisp.sh && cd ~ && clisp to get CLISP 2.49 in your terminal!

Tutorial 7 (30 May 2018)

Set ADT

Lesson plan.

  1. Wrap up on QueueADT
  2. We went over the implementation of a queue ADT in both Prolog and Lisp.

Files:

Slides from Professor Taleb

Official Lisp Handout from Professor Taleb

Tutorial 6 (28 May 2018)

Abstract Data Types and the Queue ADT

Lesson plan.

  1. Queue
  2. We went over the implementation of a queue ADT in both Prolog and Lisp.

    Prolog was more flexible and simpler, yet Lisp offers us a more familiar approach when it comes to usage of the exposed interface

  3. Set

Files:

Slides from Professor Taleb

Official Lisp Handout from Professor Taleb

Tutorial 5 (23 May 2018)

Recursion in Lisp

Lesson plan.

  1. My length using cond
  2. My length using cond
  3. Ny get nth element using auxiliary function to pass variable

Files:

Slides from Professor Taleb

Official Lisp Handout from Professor Taleb

Tutorial 4 (15 May 2018)

Lists in Depth part 2

Lesson plan.

  1. the max and min of a list
  2. repeating (twice) all the elements in a list
  3. appending a list onto another
  4. reversing a list
  5. deleting an element from a list
  6. deleting an element from a list (ALL MATCHES)
  7. getting a sublist out of a list
  8. sorting a list with mergesort

Files:

Slides from Professor Taleb

Tutorial 3 (13 May 2018)

Recursion with lists and auxiliary functions

Lesson plan.

  1. length of a list (review)
  2. length of a list + auxiliary
  3. nth element of a list
  4. nth element of a list + auxiliary

Files:

Slides from Professor Taleb

Tutorial 2 (9 May 2018)

Recursion and Lists.

Lesson plan.

  1. List representation in Prolog
  2. Prolog builtins assert/1 length/2 sumlist/2 member/2 last/2
  3. recursion
  4. first element
  5. second element
  6. third element
  7. last element
  8. membership in a list member/2
  9. definition of natural number
  10. the length of a list my_length/2
  11. the sum of all elements in a list my_sumlist/2
  12. the average of a list my_averagelist/2

Files:

Slides from Professor Taleb

Tutorial 1 (7 May 2018)

We will cover the basics of the UNIX commandline, compiling your first Prolog program.

Files:

Slides from Professor Taleb