CSC324 — Assignments and Tests

Assignment 4

Due: Apr 5 Thursday 11:59PM.

You may work on this assignment with one partner in the course.

You may submit two of assignments 1–4 up to 24 hours past the due time.

Weight: 8%.

The Question: Implement some First Order Logic in Haskell.

Assignment 3

Due: Apr 5 Thursday 11:59PM.

Much of this is review, of this course and CSC148/150, so start now and try to finish it in the coming week. There will be a shorter [if you don't fiddle blindly!] Assignment 4 due at the same time on this week's material, except for some deeper questions on the earlier course material [which I'll advise students not aiming for 80+ to skip]. Some of the material reviewed here is a required prerequisite to understand the Haskell and possibly Prolog we will cover in the next two weeks. Lack of mastery of this foundational material [especially the CSC148/150 recursion on lists and trees, simple classes/structs to represent them, polymorphism and very simple class or struct hierarchies ---e.g. Environment and Closure as sub-types of Tree] is the main reason CSC324 often goes very slowly, mostly reteaching half of CSC148/150 in two to four new sytnaxes. We will however review all that material during Haskell and Prolog, but at a 3rd-year pace assuming readiness from exposure in 1st year.

BTW, instructors who do that repeated repetition report that students either find it all easy because they master it in a language-independent way, or struggle in each pass having to muddle it out by new syntactic fiddlings that don't work in the other syntaxex. In particular the marks are not particularly higher. Instructors are also noticing this with the reduction of material in CSC108 over the last half decade: students either master it and could build and go much faster, or just take the extra time to fiddle more syntactically until the code just happens to work.

You may work on this assignment with one partner in the course.

You may submit two of assignments 1–4 up to 24 hours past the due time.

Weight: 12%.

Question 1: Syntax for function definition by pattern matching.

Question 2 parts I and II: implementing and using Logic Variables. Some context for our approach, from a couple of in-person questions about Prolog:

In practice, many CSC324 students [in other instances of the course] end up learning to mimic "regular" functions in Prolog by following certain syntactic patterns. So depending on your goals, time, interest, etc, you can master the concepts in the following explicit implementation and see it in [behind the syntax of] the Prolog code we [might] write, or learn enough code patterns to reliably answer 75% of Prolog exam [if we cover it] coding questions [and the coding in CSC384], without requiring a full understanding.

This sad historical situation is a main reason CSC384 switched to Python this term: they were providing more and more starter code as a black box, hiding the key places where Prolog style and its meaning were an advantage and illustrative. So the only benefit of Prolog was its optimized implementation [runtime speed] for certain common AI recursion patterns. But since CSC384 is a course to learn the AI concepts, not produce a production quality application, that wasn't much benefit either [and of course computers are exponentially faster than when Prolog's compilers were the only hope of getting any results from recursing through trees, in the 1970s].

Question 2 part III: More practice with Tree Recursion, Pattern Matching, and LVs.

Question 3: Backtracking. Do the practice and extension to that library, and add cut!.

Midterm 1

The Test.

Commentaries: Question 1, Question 2, Question 3.

Assignment 2

Due: Mar 15 Thursday 11:59PM.

You may work on this assignment with one partner in the course.

You may submit two of assignments 1–4 up to 24 hours past the due time.

Weight: 8%.

Solutions.

Question 1: Caching. Implement the exported functions and syntactic form.

Question 2 part I: Implement an extensible interpreter for simple expressions.
Part II: And extend it to the powerful but minimal core.

Question 3: Implement a bit of Matrix Notation and implement matrix multiplication in the usual form of the definition.

Assignment 1

Due: Feb 13 Monday 11:59PM [WAS: Feb 08 Wednesday].

You may work on this assignment with one partner in the course.

You may submit two of assignments 1–4 up to 24 hours past the due time.

Weight: 8%.

Question 1: Implement these list HOFs: for solutions see the Feb 15 lecture notes.

Question 2: Read and try the experiments in this provided library. Implement Source-formatted? as specified: solutions.

Question 3: Implement a couple of recursive tree functions: solutions.

Question 4: Report some common CSC108 Python style problems [and an error!] that students there are already making! Look at the style checker you're implementing, make some Python test case source code with those style problems, and study the result of running this Python parser on them to see how that source code is represented.

Submission: via CDF.
Please remove instructions from the files before submitting, and save the final versions in plain text format via the menu item "File/Save Other/Save Definitions As Text...".

Quiz

The Quiz.

Assignment 0

Due: Jan 26 Thursday 11:59PM.

Weight: 4%.

Questions: 1, 2, 3, 4A, 4B and 4C. Questions 1 and 4.* contain diagrams, so must be loaded into DrRacket to be read.