News for hackers. Stuff that matters.
Re:Haskell: The Bad Parts, part 2 (2020) by dwohnitmok on Tuesday February 09, 2021 @12:20PM (#26080092)
Wait why is laziness vital to large data structures? Even with strict functions on strict, but persistent functions, you almost never copy the entire data structure.

For example a strict function on a strict persistent list that swaps the head of the list doesn't have to copy the entire tail of the list.

The thing that laziness enables is short-circuiting, so e.g. a fold over the list can bail out early if necessary. But this is actually a minority of use cases for large data, since we often bound the size of data structures with something like a `take n` function for some integer n, which only processes n elements in a strict language.

There are no comments on this comment yet.