7 ms·
Can someone explain to me Alan Kay's problem with monads in functional programming? He attacks the monad concept several times in this talk rather cryptically.
by georgewsinger 10y ago
Can someone explain to me Alan Kay's problem with monads in functional programming? He attacks the monad concept several times in this talk rather cryptically.
- deleted 10y ago[deleted]
- mpweiher 10y agoI obviously can't tell you what he's thinking, but I can make an educated guess: In the video (and almost anywhere else you look) you'll note he talks about recursion on the concept of "computer" as a way to scale, because that way the parts are as powerful as the whole. If you split that concept into the sub-notions of "procedures" and "data", you no longer have that recursive principle, and "functions" in this context are sufficiently equivalent to procedures. Going the other way, functions don't really scale up, many if not most things in computing are not functions to be computed. One could argue that computers and "computer science" are misnamed, as computation is more the exception than the rule. "Data-around-shufflers" would be more appropriate. I didn't see the exact monad references, but they look like ways of working around the fact that the "function" primitive is inappropriate. It is really nice, mind you, and has wonderful properties. Kind of like circles as the basis for astronomical orbits: they are "perfect", but the world isn't perfect in the same way, so trying to model the imperfect world with these perfect primitives leads to having to introduce epicycles/monads. My 2 €¢ Edit: “Functions are nice, but you need to advance the state of the system over time” — https://www.youtube.com/watch?v=fhOHn9TClXY&feature=youtu.be&t=1204 https://www.youtube.com/watch?v=fhOHn9TClXY&feature=youtu.be...
- liotier 10y ago> "Data-around-shufflers" would be more appropriate In the French language we have "calculateur" which is the direct translation of "computer" but only commonly used in the context of scientific computing, and "ordinateur" which is the common name for computers... The meaning of "ordinateur" pretty close to "data-around-shufflers", from latin ordino (“to order, to organize”) - https://en.wiktionary.org/wiki/ordinateur https://en.wiktionary.org/wiki/ordinateur: "in its application to computing, [ordinateur] was coined by the professor of philology Jacques Perret in a letter dated 16 April 1955, in response to a request from IBM France, who believed the word calculateur was too restrictive in light of the possibilities of these machines (this is a very rare example of the creation of a neologism authenticated by dated letter)"
- sebastianconcpt 10y agoGreat point! Due to the latin origin as you mentioned, in spanish there is this too: Ordenador. Would be more or less: "sorter" (implying that it does that to data). Very likely influenced by Perret's coined term translated to spanish
- sebastianconcpt 10y ago"Data-around-shufflers" <- that's so it!
- di4na 10y agoMonads are the way to hide the fact that state change. Basically they allow you to abstract away the concept of time. Alan Kay seems to push more in the direction of data as CRDTs or fully vector clocked, so that time is just an additional way to referenced some data. It is close to the idea of separating time from space or to combine them in two. In CS, we tend to consider a static vision of the world, and a function applied to it. When the truth is that the world exist at different time and is wildly different at each of this time. So a piece of data would be defined by its place in memory and the clock time (vector clock) it was in that memory. Closer to what CRDTs does in a way.
- swah 10y agoWhat did he mean when mentioning McCarthy having solved that "change of state" problem?
- jstimpfle 10y agoDon't know his or your context, but McCarthy is the creator of Lisp, so in a way he's one of the pioneers of functional programming (there were of course other mathematicians inventing the foundations). Which is a way to combine programs from small building blocks that are just functions knowing no global state - they always return the same answer given the same arguments. Contrast this to procedural or object oriented programming where usually the parts know a lot more about the context (state) than they really need to know. This can lead to implicit (and hard to discover) assumptions about the state of the world that are broken later on when some parts are changed, leading to bugs. The way this works is by combining functions with (higher order) functions. For example, chain a function that gets A and returns B with a function that gets B and returns C. This is done without ever speaking of concrete inputs - reducing unnecessary knowledge should lead to fewer bugs. (Whether that's a more practical approach is another question).
- pron 10y agoThat's the wrong context :) He was talking about McCarthy's later discussion of what he called "situations", and is similar to temporal logic (which came later). Functional programming doesn't satisfactorily address the state change problem.
- brudgers 10y agoI am not Alan Kay {IANAK}. My take is that from Kay's perspective computing is a mixture of mathematical and biological abstractions [he has degrees in both]. Monads only touch on the mathematical abstractions and ignore biological abstractions. My take is that Kay may be of a mind that absent biological abstractions computing is diminished in its ability to solve important problems.
- deleted 10y ago[deleted]
- lomnakkus 10y agoThe thing about biology is that it's had a ~3 bn. year head start. It's also massively contingent; see evolution by natural selection. Which means that it may not actually represent any kind of global optimum[1]. [1] EDIT: Or even a local one if you're not optimizing the same thing that biology is.