<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-11295132.post5737726437521112277..comments</id><updated>2009-01-19T07:01:31.725-08:00</updated><category term='category theory'/><category term='lawvere theories'/><category term='astronomy'/><category term='optimisation'/><category term='self-reference'/><category term='comonads'/><category term='haskell'/><category term='programming'/><category term='monad'/><category term='mathematics'/><category term='physics'/><category term='probability'/><category term='types'/><category term='quantum'/><title type='text'>Comments on A Neighborhood of Infinity: Monads in C pt. III</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.sigfpe.com/feeds/5737726437521112277/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html'/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://homepage.mac.com/sigfpe/.Pictures/Photo%20Album%20Pictures/2002-12-07%2014.53.40%20-0800/ImageDSC01397_1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-11295132.post-18489029713552856</id><published>2007-06-27T15:02:00.000-07:00</published><updated>2007-06-27T15:02:00.000-07:00</updated><title type='text'>Steven,&lt;br&gt;&lt;br&gt;In pure functional programming lang...</title><content type='html'>Steven,&lt;BR/&gt;&lt;BR/&gt;In pure functional programming languages you aren't allowed to cause side effects. The only way a function can 'interact' with the outside world is to return something. So if you have a function that needs to return a number, but has a certain side effect, the only way to do this is to return the number and return some data 'containing' the side effect. But that's a pain in the ass - you have to write all of your code to return multiple values, and you have to write plumbing code to pass these side-effect containing values around. What monads can do is give a uniform API to side-effect containing data so you can just concentrate on the number that you want to return, and have the side-effect carried along automatically in the background. What's neat about monads is the same API can be used for many different problems, not just handling side-effects.&lt;BR/&gt;&lt;BR/&gt;So half the time when dealing with monads we're solving a problem that we've caused in the first place by using a pure functional language. (But sometimes it's worth using a pure functional language because of other benefits.) The other half of the time we're using monads because they provide facilities that are very hard to implement otherwise - such as logic programming or continuation passing style. I've not given C++ examples of the latter because it would be way too hard. So I've only given examples of things that you can easily implement already in C++.&lt;BR/&gt;&lt;BR/&gt;If you ever get a chance, check out the list monad in Haskell. It's beautifully simple, and yet it takes a considerable amount of work to implement the same thing in C++.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/18489029713552856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/18489029713552856'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html?showComment=1182981720000#c18489029713552856' title=''/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html' ref='tag:blogger.com,1999:blog-11295132.post-5737726437521112277' source='http://www.blogger.com/feeds/11295132/posts/default/5737726437521112277' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-961546855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-15404501274679080</id><published>2007-06-27T14:24:00.000-07:00</published><updated>2007-06-27T14:24:00.000-07:00</updated><title type='text'>Perhaps I misunderstood, but it looks like the wra...</title><content type='html'>Perhaps I misunderstood, but it looks like the wrapping and unwrapping is being done to hide data in these examples.&lt;BR/&gt;&lt;BR/&gt;I guess I need to see a more complex example where the pattern makes something easier/clearer to understand why I'd want to use it.&lt;BR/&gt;&lt;BR/&gt;I'm not trying to be difficult, I'm just slow (at least when it comes to monads). :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/15404501274679080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/15404501274679080'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html?showComment=1182979440000#c15404501274679080' title=''/><author><name>Steven Brandt</name><uri>http://www.blogger.com/profile/02657324020868587426</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html' ref='tag:blogger.com,1999:blog-11295132.post-5737726437521112277' source='http://www.blogger.com/feeds/11295132/posts/default/5737726437521112277' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1766682447'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-1898669404526026594</id><published>2007-06-27T07:57:00.000-07:00</published><updated>2007-06-27T07:57:00.000-07:00</updated><title type='text'>Steven,&lt;br&gt;&lt;br&gt;Not sure what you're trying to achi...</title><content type='html'>Steven,&lt;BR/&gt;&lt;BR/&gt;Not sure what you're trying to achieve using a private member.&lt;BR/&gt;&lt;BR/&gt;My goal here isn't to do anything useful but to simply translate one of the simplest monads into C++ to make the way it works more apparent to people with a C++ background. It's not something that anyone would really write in C++, it's just a baby example in the hope that it illustrates the pattern. A more sophisticated monad like the list monad allows you to do things like logic programming in Haskell, something that is much more difficult to implement in C++ and really leverages the usefulness of monads. But it helps to understand these simple examples first.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/1898669404526026594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/1898669404526026594'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html?showComment=1182956220000#c1898669404526026594' title=''/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html' ref='tag:blogger.com,1999:blog-11295132.post-5737726437521112277' source='http://www.blogger.com/feeds/11295132/posts/default/5737726437521112277' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-961546855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-2848336689571312550</id><published>2007-06-27T07:28:00.000-07:00</published><updated>2007-06-27T07:28:00.000-07:00</updated><title type='text'>If you were doing this in C++, you could just acco...</title><content type='html'>If you were doing this in C++, you could just accomplish this by labeling a variable as private, right? Then you wouldn't need to wrap and unwrap it all the time.&lt;BR/&gt;&lt;BR/&gt;I keep looking at examples like this of monads, and I can't figure out what the excitement is.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/2848336689571312550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/5737726437521112277/comments/default/2848336689571312550'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html?showComment=1182954480000#c2848336689571312550' title=''/><author><name>Steven Brandt</name><uri>http://www.blogger.com/profile/02657324020868587426</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2007/03/monads-in-c-pt-iii.html' ref='tag:blogger.com,1999:blog-11295132.post-5737726437521112277' source='http://www.blogger.com/feeds/11295132/posts/default/5737726437521112277' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1766682447'/></entry></feed>
