# McMaster University Functional Programming

Comp Sci 3FP3, Term 2 2020/21

## Lectures

Term 2: Monday, Thursday 12:30-13:20, Tues 13:30-14:20, online

## Tutorials

Friday 1:30-2:30, Virtual

## Instructor

Dr. J. Carette, ITB-168 , ext 26869, email: carette@mcmaster.ca.

I can be reached most easily via the class Discord (see Avenue for details), email, or right after class. Please make an appointment to see me if you have specific questions.

## Teaching Assistant

Jason Balaci (balacij)

## Course Objectives

The calendar description says: Functional programming; lists and algebraic data types, pattern matching, parametric polymorphism, higher-order functions, reasoning about programs; lazy and strict evaluation; programming with monads; domain-specific languages. However, as most of these things have been somewhat covered in COMPSCI 1JC3, the material will here be covered in much more depth.

There will be no official textbook. However The Craft of Functional Programming by Simon Thompson still contains useful material.

### Preconditions

Will be posted soon. But generally, all the material from 2DM3 and 2FA3 will be assumed, as well as a certain 'programming maturity'.
1. Students should know and understand:
1. Logical Formalism
2. Calculational Proofs in Propositional and Predicate Logic
3. Induction, Recursion
4. Discrete Structures: Sets, Functions, Relations
5. Abstract data types
6. The basics of Haskell (first 1/2 of Thompson book).
2. Students should be able to
1. Write programs in imperative and OO languages
3. Debug programs
4. Use the command line to call compilers and other tools

### Learning Objectives

1. Students should know and understand
1. What parametric polymorphism is
2. The difference between lazy and strict evaluation
4. Understand various ways of dealing with effects
5. Understand the members of the typeclassopedia
7. Understand recursion schemes
2. Students should be able to
1. Use lists and other algebraic data types to solve problems
3. Give general types for their functions
4. Use and create higher-order functions
5. Reason about the correctness of their functions
6. Write properties that their functions should satisfy
7. Use randomized testing
8. Use monads (and do notation) for encapsulating effects
9. Build small DSLs and interpreters for them
10. Be able to use Optics for a variety of tasks
11. Be able to do simple meta-programming with Template Haskell.

Note that not all objectives will be measured for marks.

Some of the graduate attributes below will be measured (probably most), in some fashion. These are measurements for the purposes of understanding your overall state in terms of the attributes which the CEAB deems important for engineers (and will be done even though you are in CS). Some will be measured through assignments, presentations and deliverables (and worth marks), while others will be done via other means not directly tied to course marks.

• 1 A knowledge base for engineering
• 1.1 Competence in Mathematics
• 1.4 Competence in Specialized Engineering knowledge
• 2 Problem Analysis
• 2.1 Demonstrates an ability to identify reasonable assumptions including identification of uncertainties and imprecise information that could or should be made before a solution path is proposed
• 2.2 (Demonstrates an ability to identify reasonable assumptions (including identification of uncertainties and imprecise information) that could or should be made before a solution path is proposed
• 3 Investigation
• 3.1 Recognizes and discusses applicable theory knowledge base
• 3.2 Selects appropriate model and methods and identifies assumptions and constraints
• 4 Design
• 4.2 Recognizes and follows engineering design principles including appropriate consideration of environmental, social and economic aspects as well as health and safety issues
• 4.3 Proposes solutions to open-ended problems
• 5 Use of engineering tools
• 5.2 Demonstrates an ability to use modern/state of the art tools

### Rubrics

Section to be completed.

## Electronic Materials

The latest version of this outline and the most "up-to date" information as well as hand-outs can be found on the course web page. http://www.cas.mcmaster.ca/~carette/CS3FP3/W2021/index.html. (Or go to my home page and then to the course page). Avenue will be used for handing in assignments. Discord will be used for further coordination.

The assignments will be worth 50%, two midterms (each 15%) and a final worth 20%. More specifically, there will be 5 assignments, each worth 10%. The final exam covers the whole course.

As usual, there will be (significant) bonus parts on the assignments.

Marking schemes will be strict: code that does not compile will be worth very few marks (if any). You will be better off submiting a partial implementation that compiles that one that is 'almost done' but doesn't typecheck.

Each assignment will have a rubric with more details on how it will be graded. If grades need to be adjusted, most commonly the denominator will be reduced, i.e. some questions will be made 'bonus'.

MSAF on assignments will always be a 4 day extension from the original due date regardless of when it is submitted. MSAFs on midterms will be handled on a case-by-case basis. Late assignments are not accepted (without an MSAF).

## Notes:

#### Schedule Changes

At certain points in the course it may make good sense to modify the schedule. The instructor may modify elements of the course and will notify students accordingly (using the standard communication mechanisms used for the class).

#### Discrimination

The Faculty of Engineering is concerned with ensuring an environment that is free of all adverse discrimination. If there is a problem that cannot be resolved by discussion among the persons concerned individuals are reminded that they should contact their Chair, the Sexual Harassment Office or the Human Rights Consultant, as soon as possible.

You are expected to exhibit honesty and use ethical behaviour in all aspects of the learning process. Academic credentials you earn are rooted in principles of honesty and academic integrity. It is your responsibility to understand what constitutes academic dishonesty.

Academic dishonesty is to knowingly act or fail to act in a way that results or could result in unearned academic credit or advantage. This behaviour can result in serious consequences, e.g. the grade of zero on an assignment, loss of credit with a notation on the transcript (notation reads: “Grade of F assigned for academic dishonesty”), and/or suspension or expulsion from the university. For information on the various types of academic dishonesty please refer to the Academic Integrity Policy, located at https://secretariat.mcmaster.ca/university-policies-procedures- guidelines/

The following illustrates only three forms of academic dishonesty:

• plagiarism, e.g. the submission of work that is not one’s own or for which other credit has been obtained.
• improper collaboration in group work.
• copying or using unauthorized aids in tests and examinations.

#### AUTHENTICITY / PLAGIARISM DETECTION

Some courses may use a web-based service (Turnitin.com) to reveal authenticity and ownership of student submitted work. For courses using such software, students will be expected to submit their work electronically either directly to Turnitin.com or via an online learning platform (e.g. A2L, etc.) using plagiarism detection (a service supported by Turnitin.com) so it can be checked for academic dishonesty. Students who do not wish their work to be submitted through the plagiarism detection software must inform the Instructor before the assignment is due. No penalty will be assigned to a student who does not submit work to the plagiarism detection software. All submitted work is subject to normal verification that standards of academic integrity have been upheld (e.g., on-line search, other software, etc.). For more details about McMaster’s use of Turnitin.com please go to www.mcmaster.ca/academicintegrity.

#### COURSES WITH AN ON-LINE ELEMENT

Some courses may use on-line elements (e.g. e-mail, Avenue to Learn (A2L), LearnLink, web pages, capa, Moodle, ThinkingCap, etc.). Students should be aware that, when they access the electronic components of a course using these elements, private information such as first and last names, user names for the McMaster e-mail accounts, and program affiliation may become apparent to all other students in the same course. The available information is dependent on the technology used. Continuation in a course that uses on-line elements will be deemed consent to this disclosure. If you have any questions or concerns about such disclosure please discuss this with the course instructor.

#### ONLINE PROCTORING

Some courses may use online proctoring software for tests and exams. This software may require students to turn on their video camera, present identification, monitor and record their computer activities, and/or lock/restrict their browser or other applications/software during tests or exams. This software may be required to be installed before the test/exam begins.

#### CONDUCT EXPECTATIONS

As a McMaster student, you have the right to experience, and the responsibility to demonstrate, respectful and dignified interactions within all of our living, learning and working communities. These expectations are described in the Code of Student Rights & Responsibilities (the "Code"). All students share the responsibility of maintaining a positive environment for the academic and personal growth of all McMaster community members, whether in person or online. It is essential that students be mindful of their interactions online, as the Code remains in effect in virtual learning environments. The Code applies to any interactions that adversely affect, disrupt, or interfere with reasonable participation in University activities. Student disruptions or behaviours that interfere with university functions on online platforms (e.g. use of Avenue 2 Learn, WebEx or Zoom for delivery), will be taken very seriously and will be investigated. Outcomes may include restriction or removal of the involved students’ access to these platforms.

#### ACADEMIC ACCOMMODATION OF STUDENTS WITH DISABILITIES

Students with disabilities who require academic accommodation must contact Student Accessibility Services (SAS) at 905-525-9140 ext. 28652 or mailto:sas@mcmaster.ca to make arrangements with a Program Coordinator. For further information, consult McMaster University’s Academic Accommodation of Students with Disabilities policy.

#### REQUESTS FOR RELIEF FOR MISSED ACADEMIC TERM WORK

McMaster Student Absence Form (MSAF): In the event of an absence for medical or other reasons, students should review and follow the Academic Regulation in the Undergraduate Calendar "Requests for Relief for Missed Academic Term Work".

#### ACADEMIC ACCOMMODATION FOR RELIGIOUS, INDIGENOUS OR SPIRITUAL OBSERVANCES (RISO)

Students requiring academic accommodation based on religious, indigenous or spiritual observances should follow the procedures set out in the RISO policy. Students should submit their request to their Faculty Office normally within 10 working days of the beginning of term in which they anticipate a need for accommodation or to the Registrar's Office prior to their examinations. Students should also contact their instructors as soon as possible to make alternative arrangements for classes, assignments, and tests.