Navigation
index
next
|
previous
|
Intro to CS 2022
»
Lecture Notes, Week 03
ΒΆ
Towards OCaml
Binary relations – a reminder
Mathematical functions – a reminder
Total functions – a reminder
Partial functions – a reminder
Equivalence of functions / functional equality
Functions in Computer Science
Program equivalence, revisited
Postlude
In a nutshell
Version
OCaml: a language of algebraic expressions, with names and functions
The toplevel loop
Comments
Integers
Booleans
Characters
Interlude
Strings
Interlude
Conditional expressions
Exercise 01
Type errors in OCaml
Pairs
Interlude
Exercise 02
Interlude
Exercise 02, with more punctuation marks
Interlude
Tuples
Exercise 03
Interlude
The empty tuple
Exercise 04
Interlude – parentheses in OCaml
Exercise 05
Names and type environments
Exercise 06
Solution for Exercise 06
Interlude about environments and onion bulbs
Names and (value) environments
Predeclared names
Declaring a global variable
Declaring several global variables at once
Functions
Predeclared functions
Express interlude
Functions that return functions
Syntactic sugar for functions that return functions
Predeclared functions that return functions: integer addition
Another predeclared function that returns a function: integer subtraction
More predeclared functions that return functions
Interlude about errors
Even more predeclared functions that return functions
Interlude about errors
Interlude about corner cases
Exercise 07
Exercise 08
Analysis of Exercises 07 and 08
Artistic interlude
Ground equality
Functions as parameterized expressions (a post-rationalization)
Exercise 09
Solution for Exercise 09
Exercise 10
Exercise 11
Exercise 12
Naming functions
Syntactic sugar for naming functions
Interlude
Functions as parameterized functions (a post-rationalization)
Syntactic sugar for naming functions that return functions
Food for thought
Functions that are applied to functions
Version
Unit tests
Resources
Unit tests
Interlude about unit tests and the unit type
Unit tests for the factorial function
Unit tests for the fibonacci function
Exercise 13
Exercise 14
Exercise 15
Solution for Exercise 15, Version 1
Solution for Exercise 15, Version 2
Exercise 16
Exercise 17
Exercise 18
The glass is half empty
The glass is not half full
Interlude
Exercise 19
Partial solution for Exercise 19
Exercise 20
Code coverage
Resources
Version
Using Emacs to interact with the OCaml processor
Requirements
What can go wrong
Perspectives
A concrete example
Last but not least
Version
Exercises for Week 03
Exercise 00
Resources
Mandatory exercises
Recommended exercises
Exercise 21
Solution for Exercise 21
Interlude
Resources
Version
Previous topic
Exercises for Week 02
Next topic
Towards OCaml
Quick search
Enter search terms or a module, class or function name.
Navigation
index
next
|
previous
|
Intro to CS 2022
»