Comments on: Recursion Schemes: A Field Guide (Redux) http://comonad.com/reader/2009/recursion-schemes/ types, (co)monads, substructural logic Sat, 29 Dec 2012 15:18:06 -0800 http://wordpress.org/?v=2.8.4 hourly 1 By: Edward Kmett http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-14071 Edward Kmett Sun, 24 Jan 2010 18:33:30 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-14071 @Damien: Regarding "le compte est bon" you can implement that fairly directly as a hylomorphism. You need an algebra for an anamorphism that generates a list of all trees, and a coalgebra for a catamorphism that searches the list for the answers. With more thought there is probably some kind of dynamorphic variation that evaluations the subtrees, figures out their valuation, and then proceeds as above, saving some effort in computing valuations of the subtrees in the catamorphism. For that matter, there is the code elsewhere on this blog for incremental folds which might be an easier way to integrate that incremental result. The Rubik's cube is probably most easily solved in the same manner. The choice of catamorphism will determine if you search breadth-first, depth-first, or using some other strategy. @Damien:

Regarding “le compte est bon” you can implement that fairly directly as a hylomorphism. You need an algebra for an anamorphism that generates a list of all trees, and a coalgebra for a catamorphism that searches the list for the answers.

With more thought there is probably some kind of dynamorphic variation that evaluations the subtrees, figures out their valuation, and then proceeds as above, saving some effort in computing valuations of the subtrees in the catamorphism. For that matter, there is the code elsewhere on this blog for incremental folds which might be an easier way to integrate that incremental result.

The Rubik’s cube is probably most easily solved in the same manner. The choice of catamorphism will determine if you search breadth-first, depth-first, or using some other strategy.

]]>
By: Damien Guichard http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-13783 Damien Guichard Mon, 11 Jan 2010 16:35:00 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-13783 Thanks for this (co-)recursion schemes guide. I have toyed with the Charity language hence some basic schemes (catamorphism,paramorphism,anamorphism) are already familiar to me. Plus histomorphism/futumorphism are well documented by Varmo Vene. Others are not so well documented and quite difficult to grasp for mere mortal fonctional programmers like me. One corecursion scheme that i face again and again is exploration. I mean i have an arithmetic expression type and i want to solve some "le compte est bon" problem. Or i have this move type (front|back|left|right|up|down) list, and i want to solve my Rubik's cube. What corecursion scheme is that ? Thanks for this (co-)recursion schemes guide.

I have toyed with the Charity language hence some basic schemes (catamorphism,paramorphism,anamorphism) are already familiar to me.

Plus histomorphism/futumorphism are well documented by Varmo Vene.

Others are not so well documented and quite difficult to grasp for mere mortal fonctional programmers like me.

One corecursion scheme that i face again and again is exploration. I mean i have an arithmetic expression type and i want to solve some “le compte est bon” problem. Or i have this move type (front|back|left|right|up|down) list, and i want to solve my Rubik’s cube. What corecursion scheme is that ?

]]>
By: Fritz http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9565 Fritz Wed, 17 Jun 2009 20:53:47 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9565 The field guide returns! How wonderful! Thank you, Edward, as well as Jeff Cutsinger, for bringing it back from the dead. I will let my students know of its revival. The field guide returns! How wonderful! Thank you, Edward, as well as Jeff Cutsinger, for bringing it back from the dead. I will let my students know of its revival.

]]>
By: Martijn http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9554 Martijn Wed, 17 Jun 2009 12:02:33 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9554 I'm really happy to see this back up! Thank you. :-) I’m really happy to see this back up! Thank you. :-)

]]>
By: Edward Kmett http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9527 Edward Kmett Tue, 16 Jun 2009 19:39:19 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9527 I had hoped to go through and do a nice writeup on each in turn, but you're probably right. I had hoped to go through and do a nice writeup on each in turn, but you’re probably right.

]]>
By: wren ng thornton http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9498 wren ng thornton Tue, 16 Jun 2009 02:14:57 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9498 It may be worth directing the Elgot (co-)algebra entries to point to the post you mentioned above. Unless you intended to do more elaboration on them. It may be worth directing the Elgot (co-)algebra entries to point to the post you mentioned above. Unless you intended to do more elaboration on them.

]]>
By: Edward Kmett http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9371 Edward Kmett Fri, 12 Jun 2009 14:27:26 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9371 I agree. At the time I first wrote this the plan was to go through and flesh each of these out in turn. As you can see from the catamorphism link there is a lot of substance to fleshing out each one in terms of applicable laws, examples, etc. I was able to recover the text of the paramorphism entry as well, so I'll repost that some time soon (as soon as I get around to reformatting all the LaTeX in it) and see about proceeding from there. I agree. At the time I first wrote this the plan was to go through and flesh each of these out in turn.

As you can see from the catamorphism link there is a lot of substance to fleshing out each one in terms of applicable laws, examples, etc.

I was able to recover the text of the paramorphism entry as well, so I’ll repost that some time soon (as soon as I get around to reformatting all the LaTeX in it) and see about proceeding from there.

]]>
By: Leon P Smith http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9358 Leon P Smith Fri, 12 Jun 2009 00:22:00 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9358 I think you could make this even better by choosing one or maybe two concrete examples for each scheme, preferably examples that are likely to be familiar. Then write each example in two forms: one that uses your abstraction, and one that does not. I think you could make this even better by choosing one or maybe two concrete examples for each scheme, preferably examples that are likely to be familiar. Then write each example in two forms: one that uses your abstraction, and one that does not.

]]>
By: Edward Kmett http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9357 Edward Kmett Thu, 11 Jun 2009 23:18:05 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9357 construction vs. deconstruction In one the near-algebra knows about the carrier of the coalgebra. In the other the near-coalgebra knows about the carrier of the algebra. See http://comonad.com/reader/2008/elgot-coalgebras/ construction vs. deconstruction

In one the near-algebra knows about the carrier of the coalgebra.

In the other the near-coalgebra knows about the carrier of the algebra.

See http://comonad.com/reader/2008/elgot-coalgebras/

]]>
By: Craig T. Nelson http://comonad.com/reader/2009/recursion-schemes/comment-page-1/#comment-9356 Craig T. Nelson Thu, 11 Jun 2009 23:03:07 +0000 http://comonad.com/reader/2009/recursion-schemes/#comment-9356 I can't see the difference between an Elgot algebra and an Elgot coalgebra in the table. Is this a typo or simply my misunderstanding? I can’t see the difference between an Elgot algebra and an Elgot coalgebra in the table. Is this a typo or simply my misunderstanding?

]]>