Live data from Hacker News

A philosophical difference between Haskell and Lisp (2015)

chrisdone.com

11–20 of 181 posts

Re: A philosophical difference between Haskell and Lisp (2015)

#11
post #7

This is interesting to read having worked with Clojure, but never Haskell or CL. I expected the Haskell examples to look alien and the CL to look familiar, but the idiomatic Clojure solutions to the examples are almost identical to the Haskell solutions. E.g. take 5 . filter (not . p) . drop 3 becomes (->> s (drop 3) (filter (complement p)) (take 5)) ; for some sequence s I think it is also true of Clojure that it st…

Is there something similar to (->>) in Haskell?

Edit: corrected “—>”.

Re: A philosophical difference between Haskell and Lisp (2015)

#13
The remove-if-not example is pretty funny. No, it doesn't have any obvious translation into function composition, and in particular isn't equivalent to the Haskell example. Instead, :count specifies how many elements to remove and :start specifies when to start removing.

Re: A philosophical difference between Haskell and Lisp (2015)

#14

Earlier quoted context omitted.

For one Lisp is not lazy like Haskell.

Not super familiar either language, how does lazy evaluation promote the use of smaller functions?

In non-lazy languages you would need to implement laziness to manage composing functions and have good performance. An example being take 5 . filter ... If evaluation wasn't lazy you would run take 5, return the result to filter and so on.

Re: A philosophical difference between Haskell and Lisp (2015)

#15
post #2

When I was new to Haskell (and also not an experienced programmer), the following example on “functional style” had a huge positive impact on me -- where the same program is re-written in ten different ways, each time making it more modular & composable: http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way... (section 3.1... Feel free to ignore everything before/after that) It feels so much easier to both und…

The whole blog seems fun to read and informative!

Re: A philosophical difference between Haskell and Lisp (2015)

#16
Common Lisp doesn’t just have LOOP, it also has Series [1]. I think the actual philosophical difference may be that Haskell does this with compiler support for stream function composition, whereas Common Lisp does it with a set of language-level macros any user could write (if they were as smart as Richard Waters).

[1] https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node347.html

Re: A philosophical difference between Haskell and Lisp (2015)

#17
There is a strange... kind of poetry with Haskell. It is like math on wheels, math applied to procedures, math with... time.

Its appeal to me is like the appeal of math to me, not like real analysis math but abstract algebra math. The beauty, the purity of mathematics of younger days that once became lost after encountering the sad complexities of the world. Understanding every little aspect and being able to prove every part is now a luxury, and interfacing without real understanding is the more practical approach in the turbulent waters of poorly connected technological and social systems.

But still there is hope and there are dreams. We like to drench ourselves in dream qualia sometimes, and Haskell and pure math are that medium. The abstractions of it, the consistency of it, the purity of it... When Haskell is called a pure language, it almost goes beyond the static definition of functions being pure, and describes the general feeling that occurs when writing Haskell. You feel pure. You feel like you are taking these small parts and creating greater parts in an elegant buildup of abstractions, traversing one level higher and one level lower at your whim.

Lisp... maybe it’s the parentheses, maybe it’s something else... it never really caught onto me like Haskell did. Haskell feels pure and dream-like and perhaps unsuited to the world where (if you really get down to it) abstractions and types are just useful ‘human’ inventions and unfit for every usage. The world is for getting down and dirty, and mathematics, or at least the pure side of it, really isn’t. The representative mathematics of Haskell is Category Theory, and it is just as far from the level of “real” as it can be. More abstract than abstract algebra, if you will.

Abstraction itself is an intellectual operation that is also rooted in emotional detachment. Perhaps Haskell represents that kind of ideal in a modern world where practicality pays before purity.

Re: A philosophical difference between Haskell and Lisp (2015)

#18
post #2

When I was new to Haskell (and also not an experienced programmer), the following example on “functional style” had a huge positive impact on me -- where the same program is re-written in ten different ways, each time making it more modular & composable: http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way... (section 3.1... Feel free to ignore everything before/after that) It feels so much easier to both und…

Thanks a lot, this is a link to hand to aspiring FP programmers for the content is well presented.

This one made me laugh out loud: "This is sometimes called parametric polymorphism. It’s also called having your cake and eating it too."

Re: A philosophical difference between Haskell and Lisp (2015)

#19
post #8

Earlier quoted context omitted.

For one Lisp is not lazy like Haskell.

I don’t understand why the above got down-voted... Without fusing (lazy) loops, having a bunch of independent sequential transformations (each with its own loop) can make the same computation significantly slower!

Ruby or Scala don't have lazy evaluation by default, yet there are views (Scala) or lazy (Ruby), so no, you don't necessary need compiler help.

Re: A philosophical difference between Haskell and Lisp (2015)

#20
post #16

Common Lisp doesn’t just have LOOP, it also has Series [1]. I think the actual philosophical difference may be that Haskell does this with compiler support for stream function composition, whereas Common Lisp does it with a set of language-level macros any user could write (if they were as smart as Richard Waters). [1] https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node347.html

To get a feel for how these compare, the Common Lisp Cookbook gives some examples for how to do different common operations using the loop, series, and iterate packages: https://lispcookbook.github.io/cl-cookbook/iteration.html
Post reply on HN