Hi There!
I'm Thomas. I was an undergraduate Teaching Fellow for CS51: Abstraction & Design at Harvard University, which this resource is modeled after.
This resource, like CS51, is targeted at "early programmers", or those who have had a little experience with a language or two and want to explore some other areas of Computer Science. The ultimate goal is to teach people how to write elegant code that is testable, maintainable, and reusable. I do not intend for this resource to be a definitive guide on anything but rather give an introduction to a lot of subjects. Not only is it because the scope of my knowledge is so limited that an electron microscope would have difficulty pinpointing it, but also because everyone else is so smart that it'd be best for me to just link those resources from here (which I will do!). And this resource, while based on CS51, does not act as a replacement for taking the class (which I wish everyone could do). CS51 has an amazing staff of people to make the class amazing by crafting problem sets, notes, lectures, etc. Since the class covers so much, it's hard to organize everything so that it seems coherent, but I've tried my best. Each section consists of a motivation (why would we even want to learn functional programming/unit testing/functors), some goals (what is it that we plan to cover and learn), the actual material, and some examples. Ultimately, as much as I loved my CS51 experience, I am really working on A Bit of OCaml for one purpose and one purpose only - to convince others in joining me in my never ending quest to write good code, an ever elusive goal. Frustrated by my experiences in the real world of programming, where people write code haphazardly, with no regard for the finer things in life, I've resolved to travel far and wide spreading the gospel of good programming. I'd like to be Don Quixote, who slays dragons and purges the evils from the badlands and spreads civility and chivalry everywhere he goes. Note: I have not yet read Don Quixote because TV has gotten so good lately. If he turns out to be a socially shunned buffoon whose gotten lost in the mythos of the imaginary world of functional programming, I wouldn't know any better. I'm simply on a mission to civilize. Love, Thomas <3 |
Index0. Introduction
0.1 Why OCaml 0.2 What is Functional Programming? 0.2 Setting up OCaml 1. Basic OCaml Syntax 1.01 First Class Functions 1.02 Polymorphism 1.1 Conditionals/Program Control 1.2 Pattern Matching 1.3 Recursion 1.31 Tail Recursion 1.32 The Stack 1.4 A Bit More Syntax Section Examples 2. CS/FP Concepts 2.1 The Functional Evaluation Model 4. Object Oriented Programming 4.1 Basic Objects in OCaml 4.2 Inheritance 4.3 Abstract Classes 4.4 Parameterized Classes Section Examples Glossary Additional Resources Questions/Answers Contact Me |
Never put off until run time what you can do at compile time. - David Gries