Recently I participated in an F# Mentorship program and want to share some great opportunities that it provided.
In this program, mentors and mentees are randomly paired up to work on some projects together for a couple of months.
I was paired with Mårten Rånge, a great programmer who taught me a lot about functional programming!
In the very beginning, we decided to create a list of the most important points that we wanted to discuss during the mentorship program. Here is the list:
- Function Composition
- Algebraic Data Types (ADT)
- Computation Expressions
- Parallel Computation
- Property Based Testing
Function Composition
Function composition was the first and most important thing I had to learn. It looks like it’s easy to compose functions correctly, but there are some unexpected obstacles.
To learn how to compose functions properly, we started implementing a simple parser that could apply the order of operations to expressions like “1+2*3”.
So the idea is to create very simple parsers like “char” and then combine them into more complex parsers using different combinators.
We ended up with somewhat of a KVP parser that could correctly parse something like this:
https://github.com/vlukash/fsharp-mentorship/blob/master/parser/parser.fs
Parallel Computation
We chose to implement a Parallel Mandelbrot algorithm using different approaches and comparing results.
In the Parallel Mandelbrot algorithm, each pixel is independent, making this task perfect for investigating parallel computation.