Python-based monads essay (Re: Assignment versus binding)
Ben Finney
ben+python at benfinney.id.au
Sun Oct 9 20:11:38 EDT 2016
Gregory Ewing <greg.ewing at canterbury.ac.nz> writes:
> Here's the first part of the essay I said I'd write about
> monads:
Thank you for tackling this.
> http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads.html
You appreciate an important feature of this:
Often it is presented in a very abstract and mathematical way, which
tends to have an eye-glazing effect on people who aren't hard-core
mathematicians. This is an attempt to convey the basic ideas behind
monads to someone who is a programmer rather than a mathematician.
One important lack that I often see in essays written by mathematicians
about programming, is the tendency to use opaque single-character
symbols., such as might be easy to write in chalk on a blackboard.
In a programming language, though, we do not have the constraint of
writing them with chalk on a blackboard. Symbols can be given
*descriptive names*, that communicate the semantic meaning of the
symbol.
Can you re-write the code examples, for example::
def add(x, f, s):
s.add(x)
return f(s)
so that they are PEP 8 conformant? That means (in addition to 4-column
indentation at each level) that you should *choose descriptive
names* and use them consistently, to help the reader understand the
code.
--
\ “Telling pious lies to trusting children is a form of abuse, |
`\ plain and simple.” —Daniel Dennett, 2010-01-12 |
_o__) |
Ben Finney
More information about the Python-list
mailing list