End of Erlang; start of Clojure

Although i didn’t do much Erlang, Alberto did! :) Looking at this blog post allows me to appreciate Erlang through Alberto’s eyes: Erlang Day Three

Seriously impressive concurrency and fault tolerance. It’s just a simple example, but it shows us something that cannot be killed no matter what you try to do to it. You can easily see how this scales up to huge fault-tolerant telecommunications systems.

Thank you to Alberto for leading the group discussion today, that was great.

Now over to Clojure

And so we start Week 6! Clojure is a version of Lisp that runs on the Java Virtual Machine. So we have lists (obviously!), functions, dynamic typing, immutable state … ahh, well, no. As we now know, for concurrency it is best to write functions without side effects. However, Clojure includes a few tricks to help us out with mutable variables, such as transactional memory and encapsulated access via agents. I’m a little disappointed actually, i was growing rather fond of immutability.

Installing Clojure

I think i probably installed more than was necessary. I’m on Mac OS X with homebrew. I suggest you simply try:

brew install leiningen

Leiningen is a simple build tool that makes it easier to work with Clojure.

Having done that you can start a new project like so:

lein new day1

It sets up an environment for you to use and a few .clj files to get you started (including one to help you write tests!)

Now in the day1 directory you can do:

lein repl

It downloads a couple more files and starts up Java with the Clojure libraries, putting you into a Clojure console.

If that doesn’t work for you, i also did:

brew install clojure
brew install repl

But i think leiningen was all i really needed.

Advertisements

7languages7weeks – what’s happened?!

Hello!

Ummm, so i’ve been a complete failure at week 5, the Erlang week.

I finished the Scala week and was really impressed by the concurrency and actor support, as well as the ability to parse XML as a top-level concept. I think i am actually a Scala convert: it’s one that i definitely want to look into more.

I have read the Erlang text but not done the exercises. I’ve been working away from home a lot recently, in Edinburgh. I wasn’t sleeping very well, and i found i’d become very lonely. This last week it was more important for me to spend time with new friends Will, Alistair, Kate, David, Adrian, Joe and Ryan. I’ve been juggling and slacklining, finding geocaches and going out for meals. I needed to do that for my own sanity, which turned out to be more important than studying Seven Languages in Seven Weeks. Thank you to everyone who has been a friend to me the last fortnight. Scottish people are nice! :D

Alberto has kindly agreed to lead tomorrow’s discussion. I’ll be there but i don’t feel able to direct the conversation because i didn’t do the Erlang exercises.

I am now back home for a fortnight and looking forward to getting back into studying for the last two weeks of Clojure and Haskell.