Pearl No.4 - Kth Smallest in the Union of 2 Sorted Collections
Here is the Pearl No.4: Let A and B be two disjoint ordered collections with distinct elements inside. Their combined size is g…
Here is the Pearl No.4: Let A and B be two disjoint ordered collections with distinct elements inside. Their combined size is g…
It has been almost half year since my last blog post on OCaml. Well, actually I haven't even touched OCaml for that long time. My…
In this post, we will talk about producing permuations using OCaml. Generating permutations was actually one of my first self-hom…
Happy Easter Our easter egg happens to be Pearl 3. A function $ f $ can have the following properties: $ f $ takes two …
As we described in the previous post, leftist tree is a binary tree based functional heap. It manipulates the tree structure so t…
Heap is one of most important data structure, where the minimum of all elements can always be easily and efficiently retrieved. …
In a list of unsorted numbers (not necessarily distinct), such as The surpassers of an element are all elements whose indices…
Prof. Richard Simpson Bird is a Supernumerary Fellow of Computation at Lincoln College, Oxford, England, and former director of t…
When I wrote the section of When we need later substitution in Mutable, I struggled. I found out that I didn't fully understand …
While OCaml is a functional programming language and emphasises pure functional style, it allows mutable (variables and values) a…
In pure functional programming, everything is immutable. Strings, lists, values of customised types etc cannot be changed once be…
Binary Search Tree (BST) is one of the most classic data structures. The definition for its structure is shown as below: It consi…
One essential of computer programming is repeating some operations. This repetition has two forms: for / while loop and recursion…
This is a post on the three important properties of trees: height, depth and level, together with edge and path. I bet that most …
Currently in post-production. Sorry, I still haven't finished this post. As this will be the last post in the magic of thunk ser…
The dark side of thunk As discussed previously, thunk is used to encapsulate computations for later uses. Although we may not eva…
list The built-in list is a fundamental type in OCaml. We can have a list of numbers such as [1;2;3;4] or functions e.g. [fun x -…
A thunk is simply a function with the unit parameter. For example: let f() = 1 + 2 * 3;; Features It is indeed a function and s…