Python-based monads essay (Re: Assignment versus binding)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Oct 12 04:29:04 EDT 2016


On Sunday 09 October 2016 18:48, Gregory Ewing wrote:

> Here's the first part of the essay I said I'd write about
> monads:
> 
> 
http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads.html


Quoting from the essay:

"the implementation is free to use in-place mutations of the state object – 
which obviously allows considerable gains in efficiency, both in time and 
memory usage – without giving up any functional purity."

Surely that should be as follows?

"the implementation is free to use in-place mutations of the state object – 
which obviously allows considerable gains in efficiency, both in time and 
memory usage – without letting anyone know that the implementation has given up 
any functional purity."


I'm inclined to agree with James Hague (via John Cook): functional programming 
is great, until you try to be strict about it. The closer you get to 100% 
functional, the less you can use it. He reckons the sweet spot is about 85% 
functional:

http://www.johndcook.com/blog/2010/04/15/85-functional-language-purity/




-- 
Steven
git gets easier once you get the basic idea that branches are homeomorphic 
endofunctors mapping submanifolds of a Hilbert space.




More information about the Python-list mailing list