A couple of weeks ago I started this project. The idea was to program the Fibonacci function in as many languages as possible and explore various concepts of programming. I chose Fibonacci as my subject for this exploration as it is a good function that is is simple to understand yet complicated enough to show different programming techniques (unlike the hello world example one usually goes for).
The idea behind this project is manifold:
- Explore various styles of programming.
- Take small concepts and elaborate on these using a simple and well-elaborated base.
- Look at many languages.
But first of all, it is intended to just be a little side project for me too explore the world of communication.
This is the list on my current progress and a little elaboration on the concept showcased.
- Haskell: This post introduces direct recursion and accumulated recursion in Haskell.
- C: C as an imperative language is introduced, and Fibonacci was implemented in an iterative style.
- Java: The Fibonacci function is implemented by means of dynamic programming.
- Scala: Scala is the language, Continuation Passing style is the concept.
- Prolog: Fibonacci is here implemented in logic programming. Furthermore, we use ADTs to derive the argument to the function.
- Spreadsheet: The key idea is to abstract the concept of programming to include more than written text.
- Coq: The introduction of theorem proving using a programming language.
- R: Using R to plot the relationship between $n$ and $fib(n)$.
- Haskell Types: Implementing the Fibonacci function using dependent programming in Haskell.
- Python: Focusing on the relationship between list comprehensions and set definitions in mathematics.
- Fixed Point: Introducing the theoretical concept of fixed points.
From here it is just following along. This project will stay current quite some time while we explore the idiosyncrasies of programming languages.