Search code examples
functional-programmingclojure

Learning functional/Clojure programming - practical exercises?


I'm learning functional programming with Clojure. What practical exercises can you recommend? Online repositories with solutions would be perfect.

One idea I can think of is going through all the popular algorithms on sorting, trees, graphs etc. and implementing them in Clojure myself. While it could work, it may be pretty steep and I'm likely to do it inefficiently (compared to someone who knows what she's doing).


Solution

  • I would recommend doing the Project Euler exercises:

    http://projecteuler.net/

    Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

    Because many programmers are solving Project Euler exercises, you can compare the solutions to other (non-functional) programming languages, but also Clojure solutions are available: http://clojure-euler.wikispaces.com/, so you can contrast imperative vs. functional/idiomatic Clojure.

    Of course you will learn the most by first doing the exercises yourself, without consulting any of the solutions.