3 ms·
Oop's defining feature is having hidden state behind those interfaces. Pure functions do not have that
by 8note 5y ago
Oop's defining feature is having hidden state behind those interfaces.
Pure functions do not have that
- Mikeb85 5y agoMonads are the little black boxes of state that send and receive messages. According to wikipedia, "a monad is defined as a functor with additional structure". Not unlike an object.
- epolanski 5y agoMonads don’t receive nor send anything. Arrays are a type that admits a monad instance, what do they send and receive?
- hprotagonist 5y agodef x(input): tmp=input * 5 return str(tmp) hey, hidden state!
- sullyj3 5y agoIf that were Haskell instead of python, it would still work, because tmp is never mutated. So it's not really state in that sense, it's just a binding. x input = show tmp where tmp = input * 5 It would be a different story if you had something like class IntState: def __init__(self, val): self.val = val def x(input): self.val += input return str(val)