<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx</link><description>A while back I posted about my issues in C# when I was trying to write out an extensible collections API. From the high level perspective I wanted to provide useful concrete implementations of many structures that would solve most peoples needs, and I</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#149955</link><pubDate>Mon, 07 Jun 2004 09:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:149955</guid><dc:creator>Fredrik Normén</dc:creator><description>I would like to se a similar “visitor” implementation into the collection classes in the System.Collection and System.Collection.Generic namepsace.</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#150040</link><pubDate>Mon, 07 Jun 2004 13:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150040</guid><dc:creator>Nick Schweitzer</dc:creator><description>Now that is sweet!  I hadn't seen that article on MSDN Mag. with co-routines.  I can just imagine the possibilities.&lt;br&gt;&lt;br&gt;Keep it up.  Its great to see someone who so readily provides more tools for the toolbox.</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#150169</link><pubDate>Mon, 07 Jun 2004 16:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150169</guid><dc:creator>Cyrus Najmabadi</dc:creator><description>Fredrik: I'll pass your comment on and see if there's an appropriate blog you can bring up your issues to.</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#150226</link><pubDate>Mon, 07 Jun 2004 17:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150226</guid><dc:creator>Fredrik Normén NSQUARED2</dc:creator><description>Cyrus:&lt;br&gt;&lt;br&gt;Thanks!&lt;br&gt;&lt;br&gt;Don't you think it would be great if the Iterate method&lt;br&gt;&lt;br&gt;public abstract class AbstractCollection {&lt;br&gt;       public void Iterate(Action action) {&lt;br&gt;             foreach(A element in this) {&lt;br&gt;                    action(element);&lt;br&gt;             }&lt;br&gt;       }&lt;br&gt;&lt;br&gt;       public abstract IEnumerator GetEnumerator();&lt;br&gt;}&lt;br&gt;&lt;br&gt;is added to the collection classes? It's often I iterate through collections, and it would be nice to have this kind of &amp;quot;Visitor&amp;quot; pattern in the collection classes.</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#150313</link><pubDate>Mon, 07 Jun 2004 19:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150313</guid><dc:creator>SteveJS</dc:creator><description>Cyrus, I think we need to stage an intervention.  Using Fibers here is nothing but crack smoking crazy.&lt;br&gt;&lt;br&gt;The main gain over a Thread implemention of CoRoutines is the destabilizing factor fibers introduce.  These allow you to:&lt;br&gt;&lt;br&gt;1. Wail in agony as you find the debugger doesn't work.&lt;br&gt;2. Scratch your head in confusion as a fiber switch in an exception handler causes your program to do a swan dive.  (Gee I wish I could debug!)&lt;br&gt;3. Go back to wailing in agony as 3 days before you are expected to ship, a tester finds your app mysteriously runs out of address space after creating one to many enumerators.&lt;br&gt;&lt;br&gt;Check out CBrumme's Blog topics that touch on Fibers:&lt;br&gt;&lt;a target="_new" href="http://blogs.msdn.com/cbrumme/archive/2003/04/15/51351.aspx"&gt;http://blogs.msdn.com/cbrumme/archive/2003/04/15/51351.aspx&lt;/a&gt;&lt;br&gt;&lt;a target="_new" href="http://blogs.msdn.com/cbrumme/archive/2004/02/21/77595.aspx"&gt;http://blogs.msdn.com/cbrumme/archive/2004/02/21/77595.aspx&lt;/a&gt;&lt;br&gt;&lt;br&gt;We're here for you Cyrus.  Together we can help you shake this.&lt;br&gt;</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#150332</link><pubDate>Mon, 07 Jun 2004 20:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150332</guid><dc:creator>Gregg Miskelly</dc:creator><description>Don't even think about doing this. I can't believe that MSDN published this article. Don't use Fibers.&lt;br&gt;&lt;br&gt;&lt;a target="_new" href="http://blogs.msdn.com/greggm/archive/2004/06/07/150298.aspx"&gt;http://blogs.msdn.com/greggm/archive/2004/06/07/150298.aspx&lt;/a&gt;</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#150463</link><pubDate>Mon, 07 Jun 2004 23:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150463</guid><dc:creator>doug ransom</dc:creator><description>I support the work of more iterators and better iterators for .net.  I really like the way haskell does things with map, filter, fold etc. and second order programming.&lt;br&gt;&lt;br&gt;It always seems silly to me in C#/C++/Java to have to write my own foreach  loop when I am pretty sure someone already has done that.  Unfortunately, closures or lambda expressions or simulations thereof are hard in C#.  C# 2.0 looks promising here.&lt;br&gt;&lt;br&gt;The yield statement of C# 2 also looks promising.  They don't seem to use fibers or even continuations in their .net implementation. These would be nice, but my guess is that they don't work well on the stack architecture of the ecma runtime.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#151224</link><pubDate>Tue, 08 Jun 2004 21:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151224</guid><dc:creator>damien morton</dc:creator><description>Python has had map, filter, fold, etc since its inception. Being an imperative language, for imperetive programmers, they rarely get used. Theres an ongoing debate in the Python community about dropping support for them, and for dropping support of lambda.&lt;br&gt;&lt;br&gt;One of the enabling features of python that tends to reduce the need for map, filter, fold etc is list comprehensions.&lt;br&gt;&lt;br&gt;Heres an example of some comprehnsions and their functional equivalent:&lt;br&gt;&lt;br&gt;[x**2 for x in list]  &amp;lt;==&amp;gt; map(lambda x: x**2, list)&lt;br&gt;[x for x in list if x&amp;amp;1]  &amp;lt;==&amp;gt; filter(lambda x: x &amp;amp; 1, list)&lt;br&gt;[x**2 for x in list if x&amp;amp;1] &amp;lt;==&amp;gt; map(lambda x: x**2, filter(lambda x: x &amp;amp; 1, list))&lt;br&gt;&lt;br&gt;As you can see, a list comprehension is much more readable than the equivalent functional form.&lt;br&gt;&lt;br&gt;Heres the equivalent in c#&lt;br&gt;&lt;br&gt;ArrayList res;&lt;br&gt;foreach (int x in list) if (x&amp;amp;1 == 1) res.Add(x);&lt;br&gt;&lt;br&gt;Using c# in a functional mode:&lt;br&gt;&lt;br&gt;ArrayList res;&lt;br&gt;Functional.Iterate(list, delegate(int x) { if (x&amp;amp;1 == 1) res.Add(x); })&lt;br&gt;&lt;br&gt;Again, I put it to you that the imperative form is more readable.&lt;br&gt;&lt;br&gt;Itd be nice to be able to use a yield statement inside anonymous delegates though. Youd have a nice-ish syntax for doing something like list comprehensions then.&lt;br&gt;&lt;br&gt;delegate() { foreach (int x = 0; x &amp;lt; 20; x++) yield return x*x; } &lt;br&gt;would result in an iterator.&lt;br&gt;&lt;br&gt;wonder what this should result in:&lt;br&gt;delegate() { yeild return x*x; }&lt;br&gt;&lt;br&gt;eesh&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#152471</link><pubDate>Thu, 10 Jun 2004 09:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:152471</guid><dc:creator>Cyrus Najmabadi</dc:creator><description>Damien: I disagree.  I find the imperative form much more ungainly and difficult to read.  It also forces the resultant list to be an ArrayList which takes the control out of the object itself.&lt;br&gt;&lt;br&gt;The list comprehensions are extremely nice.  But I see them as syntactic sugar (not a bad thing) over the lambda functions.  I woudl still want the nice atomic operations, but am glad that the nice language syntax is there to manipulate it in readable ways.</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#428311</link><pubDate>Sun, 12 Jun 2005 00:19:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:428311</guid><dc:creator>Des Kenny</dc:creator><description>About : &amp;quot;Python has had map, filter, fold, etc since its inception. Being an imperative language, for imperetive programmers, they rarely get used. Theres an ongoing debate in the Python community about dropping support for them, and for dropping support of lambda. &lt;br&gt;&lt;br&gt;One of the enabling features of python that tends to reduce the need for map, filter, fold etc is list comprehensions. &lt;br&gt;&amp;quot;&lt;br&gt;&lt;br&gt;Haskell has both named functions over collection domains such as map, filter ... and list comprehensions over list domains. List comprehensions are just an application of the very old mathematical form of set comprehensions used on list domains, which are not strictly sets. Haskell also has lambda expressions (nameless functions). Theoretically you could have a collection comprehension over any collection domain ( type). It is just a matter of writting the rules of logic that define the function over that collection domain and using your favourite bracket notation&lt;br&gt;So take your pick of whichever style you prefer. They are all logically equivalent.</description></item><item><title>re: Internal vs. External Iterators (revisted)</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#489069</link><pubDate>Fri, 04 Nov 2005 18:22:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:489069</guid><dc:creator>Ben</dc:creator><description>&amp;quot;Python has had map, filter, fold, etc since its inception. Being an imperative language, for imperetive programmers, they rarely get used. Theres an ongoing debate in the Python community about dropping support for them, and for dropping support of lambda. &lt;br&gt;&lt;br&gt;One of the enabling features of python that tends to reduce the need for map, filter, fold etc is list comprehensions.&lt;br&gt;&lt;br&gt;Heres an example of some comprehnsions and their functional equivalent: ...&amp;quot;&lt;br&gt;&lt;br&gt;Um, list comprehensions are functional: &lt;a rel="nofollow" target="_new" href="http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?list+comprehension"&gt;http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?list+comprehension&lt;/a&gt;&lt;br&gt;&lt;br&gt;As others have mentioned, list comprehensions are just syntactic sugar for combinations of map, filter, and concat.&lt;br&gt;&lt;br&gt;</description></item><item><title> Cyrus Blather Internal vs External Iterators revisted | My Site</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#9674480</link><pubDate>Mon, 01 Jun 2009 07:08:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9674480</guid><dc:creator> Cyrus Blather Internal vs External Iterators revisted | My Site</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://patiochairsite.info/story.php?id=349"&gt;http://patiochairsite.info/story.php?id=349&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Cyrus Blather Internal vs External Iterators revisted | pool toys</title><link>http://blogs.msdn.com/cyrusn/archive/2004/06/07/149893.aspx#9774816</link><pubDate>Thu, 18 Jun 2009 12:02:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9774816</guid><dc:creator> Cyrus Blather Internal vs External Iterators revisted | pool toys</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://pooltoysite.info/story.php?id=2328"&gt;http://pooltoysite.info/story.php?id=2328&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>