Re:Grenade: Deep Learning in Haskell
by axman6 on Thursday May 25, 2017 @01:04AM
(#14415383)
Recursion is only a bad idea in languages with poor support for recursion, it's not difficult to write efficient Haskell code which produces good assembly with fairly obvious recursive algorithms. Optimisations like stream fusion and libraries like foldl also contribute to really good code generation (not guaranteed and also not generally applicable optimisations, but certainly helpful)
[ Parent
| on HN ]
Re:Grenade: Deep Learning in Haskell
by mr_overalls on Thursday May 25, 2017 @10:59AM
(#14417714)
Does Haskell provide tail-call optimization or similar optimization to take away the stack-space costs of recursive function calls?
Re:Grenade: Deep Learning in Haskell
by Terribledactyl on Thursday May 25, 2017 @04:54PM
(#14420085)
GHC can, if you want it to. It's hard to answer in a general way because of the laziness, and you can always force evaluation. But then you rob GHC of potentially better optimizations, like never executing it in the first place.
This SO does a good job of explaining the trade offs. https://stackoverflow.com/questions/13042353/does-haskell-ha...