2 ms·
I took an intro CS class in Haskell so I can answer this from experience. For simple functions Haskell is similar to algebra and quite easy to learn. Haskell al
by wmf 4y ago
I took an intro CS class in Haskell so I can answer this from experience. For simple functions Haskell is similar to algebra and quite easy to learn. Haskell also forces you to understand recursion instead of punting and writing iterative code. I started to find it challenging when getting into concepts that require lazy evaluation like infinite lists; we were never taught, and I still don't know, how this kind of code is executed. And of course since no real language uses lazy evaluation that knowledge wouldn't have been useful to me long-term anyway.
- amichail 4y agoWhile recursion may seem magical at first, it is not that important in day to day programming in languages like Python/Java. In any case, a Python assignment could require the use of recursion for the purpose of teaching recursion.
- Jtsummers 4y agoLazy evaluation works in a manner similar to generators in languages like Python. Deferring execution until it's actually asked for by enclosing the unexecuted bit in a "thunk" (Haskell term, in particular, but not the origin). Thunks can be simulated in eager languages using closures, coroutines, and continuations (among other approaches). If you've ever used futures and promises that are computed only when asked for, then you've seen lazy evaluation in an eager language. Java's Stream API makes use of lazy evaluation for the same reasons Python uses generators, deferring expensive or memory consuming actions until needed.