This course will teach functional programming. More than another programming language, this is another approach to problem solving. You will learn how to write code that is, at the same time, a definition and an algorithm, and to prove this code correct.
Lectures: Sun-Tue 15:00 ~ 16:20 (CMB 1064)
Recitations: Thu 15:00 ~ 16:20 (CMB 2035)
Prereq: (21127 or 15151) and (15112)
Piazza: (important announcements will be posted there)
Instructor: Giselle Reis
Office: CMU-Q 1008
Office hours: by appointment
Teaching Assistant: Sharjeel Khan
Office: CMU-Q 1210
Office hours: whenever the office door is open, or send an e-mail to schedule an appointment
Teaching Assistant: Abdulrahman Alfayad
Office hours: Mondays 15:00 ~ 16:30, Wednesdays 16:00 ~ 16:30 and by appointment
Setting up your programming environment:
The functional programming language we will use for this course is in the ML (for Meta-Language) family and it is called SML (Standard ML). There are different compilers for (i.e. implementations of) SML, but your code will be tested with Standard ML of New Jersey (or SML/NJ) version 110.81.
You can use SML/NJ in one of two ways:
1. On CMU’s machines: All machines should have SML/NJ installed, so you can use it by simply ssh-ing them (type ‘ssh email@example.com’ in a terminal and press enter).
2. On your machine: Go to http://www.smlnj.org/ to download the files and follow the installation instruction for your operating system. Having a local installation is convenient since you will not need to rely on a good internet connection and you can compile local files edited on your favorite text editor. I recommend vim or emacs (both can be used in a terminal, and remember to keep an eye on the status bar at the bottom of the screen).
If you are using emacs, there is an sml-mode where you can edit your file and run it interactively. To install, see http://elpa.gnu.org/packages/sml-mode.html. Here are a few useful commands (C-x means hit Ctrl+x):
– C-x C-f : open a file (if this is a .sml file and sml-mode is installed, you should see (SML) on the status bar)
– C-space : select a text region
– C-x C-c : exit emacs
Additionally, the following commands can be used to interact with the repl
– C-c C-l : load the file in an sml repl (first time asks the name of the sml command used)
– C-x ` : find the next error (` is the grave accent key. On my keyboard layout, I need to press this key + space to actually type it.)
– C-c C-b : send selected region to sml repl
As far as I know, there is no sml integration with vim, but this is a good text editor which I use on a daily basis. Vim has three main modes: command, insert or visual. By default, it starts on command mode. You can enter insert mode (for editing) by typing i and visual mode (for selecting) by typing v. Hitting ESC will return to command mode. Here are a few useful commands:
– i : enter insert mode
– ESC : return to command mode
– :w : write file (aka save)
– :q : quit vim
As for the rest, you can find a million resources online, so just google it 😉
Homework: 45% (9 x 5%)
– Due on Tuesdays before class (i.e. 14:59)
– May contain written and programming parts
– To be solved individually
– Evaluated based on:
* Correct type-checking
* Correct functionality
* Presence of structured comments (type, description, requires/ensures)
* Presence of test-cases
* Well-written code
Project: 30% (2 x 15%)
– Involves programming and documenting the solution
– Evaluated on the basis of correctness, clarity and elegance (no typos and no bad grammar).
– Attending labs.
– Asking and answering questions and contributing to discussions in class.
– Participating on discussions on Piazza.
– Using LaTeX for assignments.
Final exam: 20%
Schedule (subject to change):
You are expected to comply with the university policy on academic integrity (see also The Word and Understanding Academic Integrity).
Collaboration is regulated by the whiteboard policy: you can bounce ideas about a homework with other students, but when it comes to typing it down for submission, you are on your own. You are not allowed to use notes, files, pictures, etc, from any previous discussion nor previous versions of this course.
And remember not to ignore your inner voice when it says “That’s probably not the best decision…”.
An Invitation to Students with Learning Disabilities:
Carnegie Mellon University is committed to providing reasonable accommodations for all persons with disabilities. To access accommodation services you are expected to initiate the request and submit a Voluntary Disclosure of Disability Form to the office of Health & Wellness or CaPS-Q. In order to receive services/accommodations, verification of a disability is required as recommended in writing by a doctor, licensed psychologist or psycho-educational specialist. The office of Health & Wellness, CaPS-Q and Office of Disability Resources in Pittsburgh will review the information you provide. All information will be considered confidential and only released to appropriate persons on a need to know basis.
Once the accommodations have been approved, you will be issued a Summary of Accommodations Memorandum documenting the disability and describing the accommodation. You are responsible for providing the Memorandum to your professors at the beginning of each semester.
Take Care of Yourself:
Do your best to maintain a healthy lifestyle this semester by eating well, exercising, getting enough sleep and taking some time to relax. This will help you achieve your goals and cope with stress.
All of us benefit from support during times of struggle. You are not alone. There are many helpful resources available on campus and an important part of the college experience is learning how to ask for help. Asking for support sooner rather than later is often helpful.
If you or anyone you know experiences any academic stress, difficult life events, or feelings like anxiety or depression, we strongly encourage you to seek support. Counseling and Psychological Services (CaPS-Q) is here to help: call 4454 8525 or make an appointment to see the counselor by emailing firstname.lastname@example.org . Consider reaching out to a friend, faculty or family member you trust for help.
If you or someone you know is feeling suicidal or in danger of self-harm, call someone immediately, day or night at 5554 7913.
If the situation is life threatening, call 999.