citizen428.blog()

Try to learn something about everything

(Best-of 2010)

After reading Fogus’ post The best things in 2010, I decided to do one of my own.

Great blog posts read:

So many that I started the weekly Information Overload.

Most viewed blog posts by me:

Favorite technical books discovered (and read):

  • “Programming in Haskell” by Graham Hutton
  • “Programming Erlang: Software for a Concurrent World” by Joe Armstrong
  • “The Little Schemer” by Daniel P. Friedman
  • “Refactoring Ruby” by Jay Fields

“Land of Lisp” by Conrad Barski and “The Joy of Clojure” by Michael Fogus and Chris Houser should also be on this list, but I haven’t finished them yet.

Favorite non-technical books read:

  • “House of Leaves” by Mark Z. Danielewski
  • “Wie der Soldat das Grammofon repariert” by Sasa Stanisic
  • “The Book Thief” by Markus Zusak
  • “Haroun and the Sea of Stories” by Salman Rushdie

Number of books read:
57

Number of books written:
Still none :-(

Favorite TV series about zombies:
The Walking Dead

Favorite programming languages:
Ruby, Clojure, Erlang, Common Lisp, Haskell, J

Programming languages used for projects both professional and not:
Ruby, Clojure, Bash, Python, JavaScript, Scheme, Haskell, SQL

Cool new technology:

  • Kindle 3
  • Instapaper
  • Dropbox

Lifestyle changes:

  • Stopped smoking
  • Started training Wing Chun

Plans for 2011:

  • More Haskell
  • More Erlang
  • More Common Lisp
  • Release more open source code
  • Reduce size of unread book pile
  • More sports

So, You Want to Learn Haskell?

Haskell is a great language and well worth your time. Here are some freely available learning resources for the aspiring Haskeller:

If you don’t mind spending money to dive into Haskell, I can really recommend Programming in Haskell, which is an excellent introduction to the language. Last but not least I also want to point out Haskellers, a networking site for finding/offering Haskell-related jobs.

Information Overload 2010-12-26

Information Overload 2010-12-19

Clojure: Deriving the Y Combinator in 7 Stolen Steps

Fixed point combinators are not only an interesting mental excersise, they also e.g. allow you to implement recursion in programming languages that don’t explicitly support it. This might be slightly academic, but that doesn’t make it less fun.

The most well-known fixed point combinator is probably Haskell B. Curry’s Y combinator, which will be the topic of this post. If you read The Little Schemer – which I whole-heartedly recommend doing by the way – you already implemented it once, but if you are like me chances are you didn’t entirely get it the first time around. So when I found this nice post on Deriving the Y Combinator in 7 Easy Steps, I decided to “translate” it from JavaScript to Clojure.

Step 1

Let’s start with a “classical” recursive factorial function (while we are at it, I think factorial is a way better example for a fold than for recursion, but everybody seems to do this):

Step 2

Now if we wouldn’t have explicit recursion, what could we do? One solution would be to call a function with itself as an argument, then call this argument with itself as an argument and on and on until the stack blows. Not so useful. To avoid this, we write a higher-order function which will return a function taking a numeric argument, which will then be used to calculate the factorial:

Step 3

While the above code works, all that duplicated code is really quite ugly, don’t you think? Let’s write a little helper to avoid that (I was too lazy for a proper refer-clojure statement, so I decided to name the helper “yrecur” instead of “recur”):

Step 4

This is better, but the double function call in the body of “fact” is still kinda ugly. Let’s hide this within another helper function called “g”, which has to be definied inside the closure of “f” in order to be able to call this function:

Step 5

Now we are getting somewhere! To make our factorial function look almost like the original recursive version, we can factor out some code to a separate wrapper:

Step 6

Instead of actually binding our helper from step 4 to “g”, we just inline it since it’s only called once anyway:

Step 7

Last but not least we also inline the wrapper from step 5, et voila, the Y combinator:

Information Overload 2010-12-12

Information Overload 2010-12-05

Hey Dude, Where’s Our Future?

“We are overcome by anguish at this illogical moment of humanity.” — Ernesto ‘Che’ Guevara

I was born in 1979, when the world still was quite a simple place. “They” hated “us”, we hated them, the ozone layer had no holes and we were only 21 years away from flying cars and all the other major technological advances the year 2000 promised. I was a bit too young to be aware of the second Cold War, but 1986 was quite a good reminder that nuclear holocaust – even though I had only the vaguest notion of what that really means – is maybe not all that desirable. Luckily enough the Berlin Wall came down in 1989 and for a brief moment it felt like we are only a few short years away from universal peace (and flying cars).

The 1990s saw – amongst others – a Gulf War, two wars in Chechnya, the Balkan Wars and the one in Kosovo. Add the Rwandan genocide, the Taliban takeover of Afghanistan, the Somali civil war and the new nuclear arms race between India and Pakistan, and suddenly world peace didn’t seem all that likely anymore. Personally the bliss of teenage ignorance saved me from worrying too much about what was going on, so not even the lack of significant advances re flying cars didn’t seem to bother me, mostly because the 1990s already had given us one of the greatest human inventions of all times, the World Wide Web. The world was becoming smaller every day and suddenly you could interact with people from all over the planet, chat, play, laugh and cry together. Surely this would facilitate mutual understanding.

Fast-forward to the year 2010: 9/11 led to the wars in Afghanistan and Iraq, religious fundamentalists are able to change school curricula and civil liberties get cut down left and right as a result of the "war on terror". I can’t talk for anyone else here, but for me that’s a rather sad and crazy state of affairs. Sure, we have made enormous technological advances, and when you look at things like life expectancy and GDP, the world is in a better shape than it ever was. But when I look around me, what I see is not what I imagined the world of 2010 to be like when I was a kid. What I do see is an absurd mix of 1984 and Brave New World, where the largest communist country has to save capitalism, the "Fortress Europe" is becoming a reality and governments are working against their citizens instead of for them: torture is en vogue again, censorship is portrayed as a necessary evil to combat child pornography and terrorism, students have to fight for proper education and downloading a movie can get you a jail sentence. We also have an “us” vs “them” situation again, just this time it’s mostly based on religion. And whenever there is the promise of paradise, life down here seems to turn into hell. I’d rather have the cold war back, because in retrospect people who fight over ideology seem a lot less likely to blow the whole place to smithereens than the ones who fight over religion.

I see this, and sometimes I feel paralyzed. But you know what, it’s mostly our fault. Wars need people to fight them, gods need people to believe in them and governments get overthrown by them. Why is it that we so happily do the first two, but seem to have trouble with the latter? Twitter is not a revolution and reposting stuff on your tumblelog is not a form of political protest. And no, the irony of writing a blog post about this is not lost on me. I just don’t know what else to do.

I think it’s about time that we all take a step back and a deep breath and fucking do something: Educate yourself! Go and learn about different cultures, different ways of life and the history of current conflicts. Don’t rely on a single source of information, but double check, triple check, question everything and try to form your own opinion. Go vote! You don’t like any party? Join one and try to change it, or start your own. When you have to, go to the streets to protest. Don’t buy into someone else’s dream, but try to live your own! It’s hard, especially compared to sitting around and complaining, but it may be worth it. Stop the world from becoming smaller again! Every so often, remind yourself that the web is not only a distribution medium for cat pictures, but also a tool for knowledge transfer and change. This is more a reminder to myself than advice for anyone else.

So where’s our future? In us! And it’s about time we all overcome our collective apathy and do something about it, otherwise we don’t need a Mayan calendar to end the world for us, we seem perfectly capable of doing that on our own.

Information Overload 2010-11-28

Information Overload 2010-11-21