News for hackers. Stuff that matters.
Re:Functional programming languages should be better at muta... by deredede on Tuesday July 30, 2024 @05:50PM (#41114480)
I think `Array.map` is a perfectly reasonable reading of "you're iterating over some structure and collecting your results in a sequence".

But sure, in the `fold` scenario where you don't know the number of results in advance (you are more likely to know if you use imperative data structures, e.g. `Hashtbl.length` is constant-time whereas `Map.cardinal` is not), lists might be faster than growing arrays with copies. They are still going to use more memory, and they are unlikely to to be faster than a rope-like structure that grows with no copies.

Re:Functional programming languages should be better at muta... by senorrib on Tuesday July 30, 2024 @07:27PM (#41115104)
It isn’t. There’s no guarantee that .map will be processed in sequence. In fact, .map is usually a great candidate for parallelization.
Re:Functional programming languages should be better at muta... by deredede on Wednesday July 31, 2024 @01:19AM (#41116577)
The "sequence" in the problem statement does not refer to the order of operations but to the data structure storing the results.

A parallel `Array.map` still computes a sequence, even though it may not compute in sequence.