tag:blogger.com,1999:blog-15136575.post2315099857902204678..comments2023-10-17T12:00:16.772+01:00Comments on Code rant: Recursive LINQ with Y-combinatorMike Hadlowhttp://www.blogger.com/profile/16441901713967254504noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-15136575.post-10868088647453559342009-12-17T18:59:20.901+00:002009-12-17T18:59:20.901+00:00I would like to ask how recursively populate that ...I would like to ask how recursively populate that class (with children), which was used for traversing?Viiktor bloghttps://www.blogger.com/profile/14581969295492956967noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-71129172434284075312009-04-21T21:41:00.000+01:002009-04-21T21:41:00.000+01:00Hi Anonymous,
In this example the enumerator has ...Hi Anonymous,<br /><br />In this example the enumerator has zero elements because the recursion bottoms out when there no children left to recurse. If you look at Mauricio Scheffer's example I mentioned, he recurses on directories but outputs files, so there are items in the enumerator. It just depeneds on what you are trying to do.Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-53901284059098638792009-04-21T09:59:00.000+01:002009-04-21T09:59:00.000+01:00Is it possible to get a enumerable with the elemen...Is it possible to get a enumerable with the elements?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-15136575.post-12092415662990485732009-03-13T15:56:00.000+00:002009-03-13T15:56:00.000+00:00Hi Patrick,Yes, of course you can write recursive ...Hi Patrick,<BR/><BR/>Yes, of course you can write recursive functions with C#, the problem is always factoring different parts of the recursive operation. The Y-combinator allows you to write (or use) non recursive functions, such as LINQ extension methods and combine them in a recursive operation.Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-61591899744897503282009-03-12T20:07:00.000+00:002009-03-12T20:07:00.000+00:00Heh, that's really cool. I agree that it's a fun ...Heh, that's really cool. I agree that it's a fun exercise, but I'm not sure there's a reason for a Y Cobminator in C# though. The language supports recursion natively.<BR/><BR/>In fact, I think F# also supports recursion natively. There's a recurse or recursive keyword or something like that.D. Patrick Caldwellhttps://www.blogger.com/profile/09236952464473670820noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-22836057748103542072009-03-08T21:17:00.000+00:002009-03-08T21:17:00.000+00:00Thanks for that Paul, I haven't had time to read i...Thanks for that Paul, I haven't had time to read it in detail yet, but looks like a very interesting series.Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-15254459866482992782009-03-06T22:40:00.000+00:002009-03-06T22:40:00.000+00:00I wrote a series of blog posts that illustrate how...I wrote a series of blog posts that illustrate how the y combinator can be derived in C# by performing many simple refactorings. Perhaps you will find it interesting:<BR/><BR/>http://www.paulbatum.com/2009/01/refactoring-towards-y-combinator-part-1.htmlPaulhttps://www.blogger.com/profile/18224234643439645641noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-66570343998811895382009-03-05T14:38:00.000+00:002009-03-05T14:38:00.000+00:00emq3, Glad you liked it :) It is a fun exercise an...emq3, Glad you liked it :) It is a fun exercise and it's really just me begining to climb the foothills of functional programming. I'm sure there must be a better way of factoring this.. anyone?Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-78030191286160292322009-03-05T14:09:00.000+00:002009-03-05T14:09:00.000+00:00Wow! If I ever followed you on a project where you...Wow! If I ever followed you on a project where you'd used that, I'd be chasing after you with a big stick! ;) It's a fun excercise, but it doesn't exactly help describe your intent.Anonymousnoreply@blogger.com