Llaisdy

Posts tagged "haskell":

Calculating Fibonacci numbers: a non-recursive formula

I recently discovered that there is a non-recursive formula for calculating Fibonacci numbers. fibn below is a naive implementation in Python (with fibr as a matching naive implementation of the recursive algorithm):

(...)

Elixir: resolve circularity with laziness!

Following on from my recent post on Knuth–Morris–Pratt illustrated, here is another perfectly acceptable haskell function (copied verbatim from the paper):

(...)

Faking a recursive closure in elixir

Recursive closures do not seem to be available in elixir (or erlang). An example discussion is on the elixir forum here. However, I recently had need of such a facility.

(...)
Other posts