TIL everything in Lisp is a function

I’m current reading Structure and Interpretation of Computer Programs as part of a study group we started during Pablo’s Fiesta. Our goal is learn Haskell by reading this book and implementing all of the exercises in Haskell instead of Lisp. So far its been really fun and it’s actually forcing me to learn both Haskell and Lisp at the same time.

I find Lisp to be a fascinating language and it actually makes a lot more sense to me than Haskell does. Going through the exercises we came across this really interesting piece of code.

Ok so what’s going on here?

  • if b > 0
    • return +
  • else
    • return –

at first i was like

I think it is really cool that symbols like + and – are just functions, therefore you can return them from an if statement. Here is how this might look in javascript.

Arguably not as cool as the Lisp example but it helped me understand it better.

OMG whats the point

The point is go out and learn you a Haskell (or any functional language other than javascript ). It’s for a greater good. I had never thought of + and – as just functions and now I’m kind of pissed that other languages don’t let you exposed them as such. Or give me a choice like Haskell does.

Herp Derp,


Ah Ha Moments – Handcrafted CSS