Re:Why Lisp Did Not and Never Will Gain Enough Traction
by drmrkela on Tuesday August 14, 2012 @09:12PM
(#4383923)
To be honest that Python list comprehension is really hard for me to internalize.
I find Ruby way much more natural.
xx.select { |x| bar(x) }
Even Clojure is better
(filter (fn[x](bar x)) xx)
or
(filter #(bar %) xx)
Re:Why Lisp Did Not and Never Will Gain Enough Traction
by wonderzombie on Wednesday August 15, 2012 @01:50AM
(#4384782)
Sure, I do, too. Ruby is one of the languages that made me experience how expressive the higher-order function pattern really is.
That said, in Python, you have to take what you can get, though. And generally I expect more people are familiar with Python than Haskell. Probably I should've used Ruby. Oh well.
Re:Why Lisp Did Not and Never Will Gain Enough Traction
by osener on Tuesday August 14, 2012 @10:01PM
(#4384062)
You don't need that anonymous function in Clojure, (filter bar xx) is enough just like Haskell.
Re:Why Lisp Did Not and Never Will Gain Enough Traction
by drmrkela on Wednesday August 15, 2012 @02:41AM
(#4384896)
You are right. Thanks.
Re:Why Lisp Did Not and Never Will Gain Enough Traction
by wonderzombie on Wednesday August 15, 2012 @01:51AM
(#4384784)
BTW, friendly tip: if you want code formatting, try using four spaces of indent. You might only need two, actually. Let's see. Two spaces:
filter foo xx
Four spaces: filter foo xx
Compare a language which forces you to write this
This is Python, but imagine you're doing this in Java or C++ instead. Every time you read a for loop, you have to re-derive what the author intended. Are they just iterating? Are they composing a new list? Remember, these loops are often more than just two lines and they are common.Contrast the above with
Or even (in Haskell) When your language gives you primitives to talk at a higher level, you can write more crisply and concisely. The simple, trivial code you've written 1e9 times is replaced by a very clear, simple definition of what you're doing. The important code, the interesting code may now speak for itself.