News for hackers. Stuff that matters.
Re:What I Wish I Knew When Learning Haskell by remcob on Saturday April 11, 2020 @11:24AM (#22842131)
What's wrong with it?
Re:What I Wish I Knew When Learning Haskell by tossup8536 on Saturday April 11, 2020 @01:02PM (#22842665)
Performance. Internal representation. You are not actually modifying things in place. Those are the equivalent of linked lists not arrays. That quicksort is not quick at all because the append operation in Haskell is linear. You can't use those lists to implement quicksort.
Re:What I Wish I Knew When Learning Haskell by lonelappde on Saturday April 11, 2020 @02:25PM (#22843194)
Haskell is lazy. a ++ b === (head a) : ((tail a) ++ b) (plus the base case)

It is only linear when you force it to evaluate, which ideally happens only once (amortized) in your program when the result is consumed. As long as you are careful, you don't get the bad quadratic performance that you'd get from something like eagerly appending a character to a string in a loop in Java. There are either gotchas, though, including relying on the compiler to do things in constant space that naively look linear, and also knowing when the compiler won't help you and you have to structure your computation manually.

Re:What I Wish I Knew When Learning Haskell by Koshkin on Saturday April 11, 2020 @03:25PM (#22843561)
“Modifying things in place” is, from the logical standpoint, an unnatural and even dangerous thing. A person that is not familiar with (imperative) programming often has a hard time understanding variables and assignments (similar to some programmers not understanding pointers). Mathematics doesn’t have assignments, either. That should tell you something...
Re:What I Wish I Knew When Learning Haskell by vkou on Sunday April 12, 2020 @12:43AM (#22846112)
It mostly tells me that mathematics does not care about runtime or space performance. Which is fine, because mathematics is about solving abstract problems, not getting a Turing machine to solve concrete problems.
Re:What I Wish I Knew When Learning Haskell by recursive on Saturday April 11, 2020 @04:08PM (#22843846)
In that case, quicksort requires danger and artifice. In any case, it's not quicksort.