"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog

Wednesday, November 10, 2010

This is not the one: On Lisp

This is not the post I'm going to write, but it is the one I'm writing.

I recently saw a tweet that reads something like, "Nice presentation on Clojure, but any language where you write 1 + 2 as (+ 1 2) is not for me." Fair enough. I won't hold it against you if you share that sentiment.

What about a language where you write 1 + 2 + 3 + ... + 1000 as:

(apply + (take 1000 (iterate inc 1)))
Lisp may seem foreign at first. And looking at a small expression in your language compared to the same in lisp may turn you off lisp forever. Fair enough.

Maybe your language has something equally as expressive. Fair enough.

But lisp is more than prefixes and parentheses, and you may want to dig deeper into the benefits of all of lisp's characteristics. Fair enough if you don't.


Marcel Weiher said...

How about:

(1 to: 1000) reduce + 0

D said...

Do you mean like this:
for (int i = 0, int j = 0; i < 1000; i++, j += i);

Anonymous said...

Hello Pat,

I recall writing a LISP program at OSU all on paper. No cards, no teletype nothing... just on paper. Now that is real LISP programming! :)
Hope you are doing well!

Doug Goodin

Patrick Logan said...

Marcel: yep.

D: nope, it's about combinators not syntax.

Doug: hi! yeah, matching parens is easier when you can use a pencil!

Duncan said...

Using 'range' in Clojure also makes this code look a little less intimidating (take, iterate, inc, etc kinda distract the situation)

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.