Wednesday, August 14, 2013

List of programming languages where immutability is default

Here is the list:
  1. Erlang
  2. Haskell
  3. OCaml
  4. F#
  5. Clojure
If you are aware of other programming languages that provide immutable data structures by default, please contribute to this list by posting a comment.

Wednesday, July 03, 2013

Getting my feet wet with Clojure's core.logic

Yesterday I read a nice article about implementing Event Sourcing in Clojure. The domain that the author had chosen to illustrate the concept was the rock-paper-scissors game. The compare-moves multimethod seemed a bit ugly to me, so I thought it would be a great opportunity to try logic programming in Clojure. Here is what I did:

1. Create a new Clojure project using Leiningen:
2. Add clojure.core.logic to project dependencies list:
3. Tell Leiningen to install the dependencies:
4. Write the rules of the rock-paper-scissors game in src/rock_paper_scissors/core.clj:
5. Start a REPL and play a little:
I hope you enjoy the declarative style! I surely do and will certainly continue my exploration of the awesome world of logic programming.