4 ms·
Yes, I have had to solve this problem a lot. It's probably my own fault because I am an inexperienced Haskell programmer, and maybe it's just because I'm incom
by brl 18y ago
Yes, I have had to solve this problem a lot. It's probably my own fault because I am an inexperienced Haskell programmer, and maybe it's just because I'm incompetent but I find space performance very difficult to reason about.
It seems like anybody can make these mistakes, and they are mostly invisible until one day your problem size is a little bit larger than normal and your program explodes and crashes.
- time_management 18y agoNoob question: Why is space performance so opaque in a lazy language?
- brl 18y agoNoob answer: In a strict language, you write an expression and it's perfectly clear when it will be evaluated. With lazy evaluation to know if or when an expression will be evaluated you have to follow it through possibly many layers of function calls (which may have been written by somebody else) looking for a place where it needs to be evaluated. Along the way it may become embedded in other expressions which complicates the problem. How do you know when an expression needs to be evaluated? I don't know if I'm smart enough to understand the answer to that question: http://en.wikibooks.org/wiki/Haskell/Denotational_semantics#Strict_and_Non-Strict_Semantics http://en.wikibooks.org/wiki/Haskell/Denotational_semantics#...