There are a number of programming puzzle sites that are worthwhile tools for learning a language, brushing up on your skills or just exploring how other people might solve problems differently than you. I think this is all good. I’ve found it especially helpful in learning a new language. One of the interesting things about trying to solve some of these puzzles with a language like Elixir is that you have to work through the problem in a different way then you would in a language like “C” or Java. Arrays and sorting are common problems where you’d index into an Array with those languages but you want to avoid that in Elixir since you’re dealing with Lists and iterating into a List gets expensive. Here’s an example of a problem where I solved it a different way.
Here’s some initial notes on coming to Clojure from Elixir. This isn’t meant to be a judgemental post. Its just my random thoughts on using a different model of functional programming. My bias would obviously be towards the one I know (Elixir). So its worth reading this with this background in mind. It’d be interesting to read someone’s thoughts on learning Elixir after using Clojure professionally. I’ve not found any blog posts about that although I’m sure there are some out there.
I decided to spend some time learning Clojure. I figured I’d install and find some good doc or
an online book to work with. The install itself was quite painless. The computer I’m using for
this is a Macbook pro and I’ve got homebrew installed. You’ll need to install Java (which I already
had) and then installing Clojure is just
brew install clojure. After reading the docs one of the
first things you’ll realize is that you need a tool called leiningen. Installing
that is also just
brew install leiningen. The online book I found is Clojure for the Brave and True. Its funny and well organized and seems up to date enough. I also signed up for an
exercism account which has a Clojure track for algorithm
practice once I get some actual chops with the language itself.
Finishing up this small project to read a DynamoDB stream with Elixir. The github repo for the project is: dynamo_streamer. This post will cover generating random data to insert into the table and reading from the stream associated with the table.
Just made a small change to this project today since I didn’t have a lot of time to work on it and got involved in looking at Clojure. The project now has some of the standard dependencies you regularly see in “real” Elixir project: excoveralls, dialyxer, credo, ex_doc. And I’ve refactored table.ex to be more general purpose and moved the creation of the actual test table for this project to user_activity.ex.