|
![](/i/fill.gif) |
>> Heh, man... I thought "it inserts user-defined code between each pair of
>> statements" would a pretty simple idea. I guess not... ;-)
>
> I should have said that I am none the wiser. I still do not know what a
> monad is.
If you have a set of things which can be "added" and "subtracted" in a
certain technical sense, this is called a monoid.
(The technical rules say things like "if you add X and Y, and then
subtract Y, the result has to be X". Stuff like that.)
A monad is a little more complicated, but essentially, if you have
- A "box" type of some sort.
- A "return" function that takes a value and sticks it in a box.
- A "bind" function that takes a box and a function that returns a box,
and calls that function with the thing(s) in the input box.
then that's a monad.
(Once again, there's a bunch of technical rules that make this
mathematically rigorous. Technically the functions have to obey certain
rules - the "monad laws" - such as "bind x id == x". But usually any
sane way of implementing the two functions about will satisfy the
requirements.)
Post a reply to this message
|
![](/i/fill.gif) |