Functional Programming – QuickSort and Fibonacci (Memoization)

GoRuCo 2013 – Functional Programming and Ruby by Pat Shaughnessy

The above is a nice session video which talks about the Ruby’s functional programming aspect, by comparing it with Haskell. There’re many topics are covered, but I found interesting about the quick sort and fibonacci examples.


In the beginning, Haskell’s quick sort example is mentioned, which is mostly the same as in here (

I tried with similar approach on Elixir as follows. They’re concise and intuitive with the power of functional programming language, nice.

Fibonacci (Memoization)

At around 35:29, Haskell memorization is described. I knew the term “memoization” previously, but didn’t know much about its meaning. After learning the functional languages, I’m getting to understand the concept of the no-side-effects and the purpose of the memoization.

The memoization is described in here ( I haven’t been able to fully understand them, but the concept of remembering/reusing the function inputs/outputs along with the lazy evaluation sounds interesting.

Elixir has “Stream” for lazy evaluation, as similar way as Ruby. As it’s not natively integrated as much as Haskell, it requires to separately store the calculation results for memoization. The following has nice discussion and some example codes on this topic.


Posted on October 27, 2013, in Conference, Elixir, Software Design. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: