3 ms·
Agreed about tail recursion in Python, promoting recursion as an alternative to loops is contrary to the sprit of Python and "one obvious way to do it". Monads
by olavk 14y ago
Agreed about tail recursion in Python, promoting recursion as an alternative to loops is contrary to the sprit of Python and "one obvious way to do it".
Monads vs imperative languages is a bit different though, since Haskell-style monads are more than just a way of allowing an imperative style. For example many other features like list comprehensions and parsing is also based on monads in Haskell. However the real value of Haskell-style monads is that it is clear when you don't use them. So it is explicit in the type system which functions have side effects and which don't.
- lmm 14y ago>Monads vs imperative languages is a bit different though, since Haskell-style monads are more than just a way of allowing an imperative style. For example many other features like list comprehensions and parsing is also based on monads in Haskell. So maybe monads are useful for implementing language internals. But if we assume my language has list comprehensions and a parser (however they're implemented internally), what would I as a user of the language want monads for? I keep hearing that monads are great, but every code example I've seen using them seems like something that I could do more easily in python, without a monad. So I'd really like to see any examples of code that you would want to write using monads, even in a language that has imperative constructs.
- talaketu 14y agoCheck some of the pyparsing examples.