Live data from Hacker News

Why I chose Common Lisp over Python, Ruby, and Clojure

postabon.posterous.com

1–10 of 143 posts

Re: Why I chose Common Lisp over Python, Ruby, and Clojure

#3
post #2

You could probably get rid of the "(fixed)" in your title; I bet most people didn't see your original submission, and the ones that did will know what happened.

Thanks. Sorry for the trouble before. I had an old personal wordpress blog that I'd originally posted this on - but there were some technical issues with upgrading WordPress to a modern version.

Just reposted the same content on Posterous.

Re: Why I chose Common Lisp over Python, Ruby, and Clojure

#6
post #4

The fact that he proposed removing map, reduce, filter, and lambda from Python 3. In the case of map and filter, is there any compelling reason to use either of those instead of list comprehensions or generator expressions?

Nope - just a style thing. You don't need lambdas either - named functions are just as powerful.

But I often think 'functionally.' Since I have options, I'd rather go with a language that allows me to program how I think - instead of being forced to translate my thought into its semantics.

Re: Why I chose Common Lisp over Python, Ruby, and Clojure

#7
I predict you will get a great deal of pythonic fire. Nevertheless, I find it very nice that you plan to deal with the specific libraries you're using in the next posts. The greatest problem in adopting CL seems to be the extremely decentralized (not to say disorganized) library spacs.

Re: Why I chose Common Lisp over Python, Ruby, and Clojure

#9
post #4

The fact that he proposed removing map, reduce, filter, and lambda from Python 3. In the case of map and filter, is there any compelling reason to use either of those instead of list comprehensions or generator expressions?

Obviously, map and filter are better because ... ah, hmm, I don't know.

I think it is a matter of language design. Higher order functions are not as prominent in Python as say, Haskell, where map & friends are generally preferred for composability. Lispers prefer map & friends just because list comprehensions add all that messy syntax.

If I were a Python programmer, I would probably use list comprehensions, since they seem to be the preferred idiom.

Re: Why I chose Common Lisp over Python, Ruby, and Clojure

#10
post #4

The fact that he proposed removing map, reduce, filter, and lambda from Python 3. In the case of map and filter, is there any compelling reason to use either of those instead of list comprehensions or generator expressions?

A single, non-nested list comprehension or generator exp is basically map(filter). You need nesting to get filter(map).

e.g.

    map(expensive_call, filter(cond, seq))
equals

    [expensive_call(each) for each in seq if cond(each)]
but

    filter(cond, map(expensive_call, seq))
equals

    [each for each in [expensive_call(x) for x in seq] if cond(each)]
note because of "expensive_call", it's inefficient (and silly) to do

    [expensive_call(each) for each in seq if cond(expensive_call(each))]

So map/filter combination gives more flexibility than list comprehension, and for functional-thinking minds, it's just so natural to think in abstract terms of passing functions around. List comprehension is pretty syntactical sugar to do similar things, but it forces you think about the "how to do" instead of "what to do".

That said, it's not really "compelling" though -- there is no real "compelling" reason to switch from one Turing-complete language to another given that you can do the same thing eventually. But hey, it's the itches that drive us nuts, isn't it? :)

Just my 2 cents

Post reply on HN