Re:The Beauty of Clojure
by crimsonalucard on Wednesday August 26, 2015 @03:08AM
(#10121527)
Which is more beautiful, haskell or clojure? This is a subjective question, so I'm hoping to read subjective and highly opinionated answers.
[ Parent
| on HN ]
They are both beautiful in their own way. Haskell is more pure, certainly, and closer to mathematical beauty, definitely. But the extraordinary flexibility of a lisp, which Clojure does immensely well, makes it more powerful than any language I've experienced for quickly expressing or manipulating an idea. Any program written in Clojure could eventually be refactored into another language, but its strength as a dynamic lisp makes it possible to really get to the heart of a problem and work out its solution without anything else getting in the way.
well that first example in the article would be
foldl (+) 0 (map (+2) [1..10])
or sum $ map (+2) [1..10]
So... make up your own mind.As someone who has written only small chunks of lisp but at many different points in life, I do find the whole parens game to be a bit disorienting, but usually I can counter it by using newlines.
I would write something like
(reduce + (map (comp inc inc) (range 10)))
as (reduce +
(map (comp inc inc)
(range 10)))Ranges are inclusive, so:
sum $ map (+2) [0..9]
Nitpick, but it confused me for a second.
Re:The Beauty of Clojure
by crimsonalucard on Wednesday August 26, 2015 @03:49AM
(#10121668)
I deal with it by using an IDE or plugin for paren highlighting.
Haskell was created to be beautiful. Clojure was created to be practical, with plenty of ugly pragmatism thrown in. If there's an argument over beauty, it should be Haskell vs Lisp (vs Prolog, vs Forth, and probably vs assembly).