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

Marko Rauhamaa marko at pacujo.net
Thu Oct 13 07:33:11 EDT 2016


Gregory Ewing <greg.ewing at canterbury.ac.nz>:
> Steve D'Aprano wrote:
>> The way you can usually tell your functional language has given up
>> purity in favour of mutating implementations is that your code
>> actually runs with non-toy amounts of data :-)
>
> Hmmm. Your argument here seems to be: "Everyone knows that functional
> languages are impractical, so if it's practical, then it can't be
> functional."
>
> If she weighs the same as a duck, she's a witch!

>From you essay:

   What's more, it's starting to look a lot like a sequential program.
   We can read it fairly clearly as "add the first element to the set,
   then add the rest of the elements to the set, unless the list is
   empty, in which case turn the set into a list and stop."

   <URL: http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/Demy
   stifyingMonads.html>

It is interesting that right after introducing lambda calculus or pure
functional programming to students, textbooks quickly proceed to
demonstrate how the functional paradigm can emulate the imperative
paradigm, as you have done above.

This suggests even the promoters of functional programming intuitively
prefer imperative programming, but that's ok as long as it's all
functional under the hood.


Marko



More information about the Python-list mailing list