4 ms·
With Haskell this isn't an issue because lists are evaluated lazily, but what I was trying to get at and failed to make clear was that other languages which all
by aduffy 10y ago
With Haskell this isn't an issue because lists are evaluated lazily, but what I was trying to get at and failed to make clear was that other languages which allow functional-like behavior can result in unnecessary allocation. For example in Python doing multiple maps/filters will allocate multiple lists unless you use the itertools versions in Python 2.7.
- sgk284 10y agoI think the proper answer here is that Python 2.x should be treated as legacy. Python 3.x defaults to generators for maps/filters by default.
- wyager 10y ago> With Haskell this isn't an issue because lists are evaluated lazily Even more than that, the compiler will actually do things like replace map f . map g with map (f . g) To eliminate unnecessary allocations.
- rubberstamp 10y agoThats great. My greatest petpeevee is having to keep in mind the language gotchas when all I want to do is get it done.
- Peaker 10y agoHaskell has far fewer correctness gotchas than other languages. They stuck to consistent, predictable behavior - even when it made things tedious for years until new techniques were discovered. Haskell does have performance gotchas, though.