News for hackers. Stuff that matters.
Re:It never makes sense to use foldl on lists in Haskell (2019) by smabie on Saturday March 21, 2020 @12:01AM (#22644310)
I mean, they might suck, but that's not really true that most languages don't use them. I can think of a lot that use them as their default data structure (OCaml, Haskell, Scala, Common Lisp, Racket, Clojure, etc). They're nice with recursion or if you don't know the size of your data ahead of time. But honestly, I've only used recursion a handful of times in my entire career, despite working almost exclusively with functional languages.
Re:It never makes sense to use foldl on lists in Haskell (2019) by didibus on Saturday March 21, 2020 @02:27AM (#22644940)
Correction for Clojure. It doesn't use singly linked list by default. It uses something more akin to an ArrayList, Clojure calls it Vector. Elements are indexed, and have pseudo O(1) lookup, and it adds to the end in pseudo O(1) as well.
Re:It never makes sense to use foldl on lists in Haskell (2019) by ninjapenguin54 on Sunday March 22, 2020 @11:57AM (#22655906)
Correction: Clojure has linked lists and vectors. Haskell has both too. https://clojure.org/guides/learn/sequential_colls https://hackage.haskell.org/package/vector-0.12.1.2/docs/Dat...

Don't blame the language, & learn to use the right data structure for the job.

Re:It never makes sense to use foldl on lists in Haskell (2019) by didibus on Monday March 23, 2020 @11:56PM (#22671723)
Parent was talking about default data-structure, and for Clojure Vectors are the default "list" data-structure, even though it has other type of lists.

Not trying to throw any of the other languages mentioned under the bus, I do not know them well enough to know what list structure they default too or more idiomatically rely on.

Re:It never makes sense to use foldl on lists in Haskell (2019) by fulafel on Monday March 23, 2020 @01:56AM (#22661584)
In Clojure, most standard functions return lazy sequences, and in code people usually use vectors which are not linked lists. But it does of course have the classic Lisp list as well.