A Crash Course in Python
Python is a powerful jack-of-all-trades language that is much less limited than OCaml.
Python is a powerful jack-of-all-trades language that is much less limited than OCaml.
Prolog is a special programming language that is not like many others. It exemplifies the paradigm of logic programming.
When we discuss the principles of programming languages, lambda calculus is the bedrock of our discussion. It is the most abstract, formal way to describe functions and application.
Currying is the concept of having multiple arguments in a function. OCaml defaults to currying its functions. int -> int -> int
is a function that takes two int
s and returns an int
.
When we make our programs more and more complex, we need more complex data types as well. We have only used OCaml's built-in data types, how can we construct our own data types?
What are the formal semantics of how a programming language works, mathematically? That's a broad topic. Operational semantics, which are how programs execute, are narrow enough for one article.
Recursion in many languages can cause significant overhead. It might seem that the excess amount of recursion in OCaml would decrease its performance. But it actually doesn't, and that's thanks to tail recursion.
We can do a lot of cool things with functions besides calling them in OCaml.
Lists are the most basic data structure in OCaml, but there are others that we need to be aware of.
Lists are the most basic data structure in OCaml. The most analoguous structure is a vector in C++ or Rust. Lists are homogenous and of arbitrary length.
A function takes arguments, performs operations using them, and returns a value. In OCaml, we can write functions like so