Navigation
index
next
|
previous
|
Intro to CS 2021
»
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
Version
OCaml: a language of algebraic expressions, with names and functions
The toplevel loop
Comments
Integers
Booleans
Characters
Interlude
Strings
Interlude
Conditional expressions
Exercise 1
Pairs
Interlude
Tuples
Exercise 2
The empty tuple
Food for thought
Interlude – parentheses in OCaml
Names and type environments
Exercise 3
Solution for Exercise 3
Names and (value) environments
Predeclared names
Declaring a global variable
Declaring several global variables at once
Functions
Predeclared functions
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
Exercise 4
Exercise 5
Analysis of Exercises 4 and 5
Artistic interlude
Ground equality
Functions as parameterized expressions (a post-rationalization)
Exercise 6
Solution for Exercise 6
Exercise 7
Exercise 8
Exercise 9
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
Unit tests for the factorial function
Unit tests for the fibonacci function
Exercise 10
Exercise 11
Exercise 12
Solution for Exercise 12, Version 1
Solution for Exercise 12, Version 2
Exercise 13
Exercise 14
Exercise 15
The glass is half empty
The glass is not half full
Interlude
Exercise 16
Partial solution for Exercise 16
Exercise 17
Code coverage
Resources
Version
Using emacs to interact with the OCaml processor
Requirements
What can go wrong
Perspectives
A concrete example
Version
Exercises for Week 03
Exercise 0
Mandatory exercises
Recommended exercises
Exercise 18
Solution for Exercise 18
Interlude
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 2021
»