<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Tree traversal extension methods</title>
	<atom:link href="http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/feed/" rel="self" type="application/rss+xml" />
	<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/</link>
	<description>A small, super fast, opensource and 100% C# IDE targetting .NET-based languages</description>
	<lastBuildDate>Tue, 08 Dec 2009 04:06:34 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: leppie</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3487</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Tue, 07 Apr 2009 14:32:16 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3487</guid>
		<description>Fixed in code now too.</description>
		<content:encoded><![CDATA[<p>Fixed in code now too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leppie</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3486</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Tue, 07 Apr 2009 14:29:20 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3486</guid>
		<description>:)

I did find a bug though with the Depth first traversal.

i.TraverseDepthFirstWithParent(i, valueselect, childselect) 

should be 

i.TraverseDepthFirstWithParent(t, valueselect, childselect)

Wrong parent!  Maybe that caused some confusion, sorry if it did!  :)</description>
		<content:encoded><![CDATA[<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I did find a bug though with the Depth first traversal.</p>
<p>i.TraverseDepthFirstWithParent(i, valueselect, childselect) </p>
<p>should be </p>
<p>i.TraverseDepthFirstWithParent(t, valueselect, childselect)</p>
<p>Wrong parent!  Maybe that caused some confusion, sorry if it did!  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Pryor</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3483</link>
		<dc:creator>Jonathan Pryor</dc:creator>
		<pubDate>Tue, 07 Apr 2009 01:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3483</guid>
		<description>I think the problem was a sudden inability to read code on my part.  I&#039;m no longer sure what I was thinking. :-(

/me shakes his head to clear his thinking...</description>
		<content:encoded><![CDATA[<p>I think the problem was a sudden inability to read code on my part.  I&#8217;m no longer sure what I was thinking. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>/me shakes his head to clear his thinking&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leppie</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3482</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Mon, 06 Apr 2009 19:49:10 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3482</guid>
		<description>The &#039;parent&#039; is the node that contains node that the value is selected from.

The easiest way to see what I mean is to simply use the identity function for the valueselector. 

In most trees, the child node will have no reference to it&#039;s parent node. The with parent methods are simply to gather this information during the enumeration.

I am not sure how you mean the semantics change mid-method. Had a quick look, but could not see anything wrong. Will have another look tomorrow.  :)</description>
		<content:encoded><![CDATA[<p>The &#8216;parent&#8217; is the node that contains node that the value is selected from.</p>
<p>The easiest way to see what I mean is to simply use the identity function for the valueselector. </p>
<p>In most trees, the child node will have no reference to it&#8217;s parent node. The with parent methods are simply to gather this information during the enumeration.</p>
<p>I am not sure how you mean the semantics change mid-method. Had a quick look, but could not see anything wrong. Will have another look tomorrow.  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Pryor</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3481</link>
		<dc:creator>Jonathan Pryor</dc:creator>
		<pubDate>Mon, 06 Apr 2009 17:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3481</guid>
		<description>Silly question time: what are the semantics supposed to be of the Traverse*WithParent() methods?  Specifically, what is the &#039;parent&#039; suposed to be -- the node that yielded the resulting value, or the parent of the node that yielded the resulting value.

Because these two different definitions seem to be used interchangably: in TraverseBreadthFirstWithParent() you have: 

yield return new KeyValuePair(valueselect(e), t);

in which the parent is the node that the value came from, and later in the same method you have:

yield return new KeyValuePair(valueselect(c), e);

in which the parent is the parent of the node that the value comes from.

This seems quite inconsistent, and makes it difficult to reasonably document the functionality of these methods (how is the user supposed to know which set of semantics is in play, especially when it changes mid-method?).

It makes me think that the *WithParent() methods should really be *WithInfo() methods, and return and IEnumerable, with:

class TreeNodeTraversalInfo
{
  public readonly TResult Value;
  public readonly TSource Node;
  public readonly TSource[] Path;
}

but maintaining Path is something that I&#039;m not sure about -- it may be too much overhead, as it&#039;ll be a required array allocation for each returned node (yech).

Though Path could instead be an IList, which would allow some sharing of the underlying array (but would still require a unique instance per item returned).</description>
		<content:encoded><![CDATA[<p>Silly question time: what are the semantics supposed to be of the Traverse*WithParent() methods?  Specifically, what is the &#8216;parent&#8217; suposed to be &#8212; the node that yielded the resulting value, or the parent of the node that yielded the resulting value.</p>
<p>Because these two different definitions seem to be used interchangably: in TraverseBreadthFirstWithParent() you have: </p>
<p>yield return new KeyValuePair(valueselect(e), t);</p>
<p>in which the parent is the node that the value came from, and later in the same method you have:</p>
<p>yield return new KeyValuePair(valueselect(c), e);</p>
<p>in which the parent is the parent of the node that the value comes from.</p>
<p>This seems quite inconsistent, and makes it difficult to reasonably document the functionality of these methods (how is the user supposed to know which set of semantics is in play, especially when it changes mid-method?).</p>
<p>It makes me think that the *WithParent() methods should really be *WithInfo() methods, and return and IEnumerable, with:</p>
<p>class TreeNodeTraversalInfo<br />
{<br />
  public readonly TResult Value;<br />
  public readonly TSource Node;<br />
  public readonly TSource[] Path;<br />
}</p>
<p>but maintaining Path is something that I&#8217;m not sure about &#8212; it may be too much overhead, as it&#8217;ll be a required array allocation for each returned node (yech).</p>
<p>Though Path could instead be an IList, which would allow some sharing of the underlying array (but would still require a unique instance per item returned).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Pryor</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3450</link>
		<dc:creator>Jonathan Pryor</dc:creator>
		<pubDate>Sat, 14 Mar 2009 04:23:40 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3450</guid>
		<description>The tree traversal methods have been added to Mono.Rocks:

http://anonsvn.mono-project.com/viewvc/trunk/rocks/Mono.Rocks/Object.cs?view=markup

The only major changes were using a KeyValuePair instead of a KeyValuePair, parameter validation, and the introduction of Create*Iterator() methods (so that the `yield&#039; statements are separate from the parameter validation logic, otherwise parameter validation would have delayed execution semantics).</description>
		<content:encoded><![CDATA[<p>The tree traversal methods have been added to Mono.Rocks:</p>
<p><a href="http://anonsvn.mono-project.com/viewvc/trunk/rocks/Mono.Rocks/Object.cs?view=markup" rel="nofollow">http://anonsvn.mono-project.com/viewvc/trunk/rocks/Mono.Rocks/Object.cs?view=markup</a></p>
<p>The only major changes were using a KeyValuePair instead of a KeyValuePair, parameter validation, and the introduction of Create*Iterator() methods (so that the `yield&#8217; statements are separate from the parameter validation logic, otherwise parameter validation would have delayed execution semantics).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leppie</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3449</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Fri, 13 Mar 2009 05:07:55 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3449</guid>
		<description>Heh, no reason, coin flip, it&#039;s not really a KeyValuePair. Just a pair of values, and I didnt feel like defining yet another class for that, and the order does not matter.

I guess best will be to make a NodePair struct with Value and Parent properties.

Feel free to make any changes.  :)</description>
		<content:encoded><![CDATA[<p>Heh, no reason, coin flip, it&#8217;s not really a KeyValuePair. Just a pair of values, and I didnt feel like defining yet another class for that, and the order does not matter.</p>
<p>I guess best will be to make a NodePair struct with Value and Parent properties.</p>
<p>Feel free to make any changes.  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Pryor</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3448</link>
		<dc:creator>Jonathan Pryor</dc:creator>
		<pubDate>Fri, 13 Mar 2009 03:30:40 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3448</guid>
		<description>Why do TraverseDepthFirstWithParent() and TraverseBreadthFirstWithParent() return a KeyValuePair (Result as Key, Parent as Value) instead of a KeyValuePair (Parent as Key, Result as Value)?  Or is there a reason?</description>
		<content:encoded><![CDATA[<p>Why do TraverseDepthFirstWithParent() and TraverseBreadthFirstWithParent() return a KeyValuePair (Result as Key, Parent as Value) instead of a KeyValuePair (Parent as Key, Result as Value)?  Or is there a reason?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leppie</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3447</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Sun, 08 Mar 2009 08:07:58 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3447</guid>
		<description>Update post, with extra methods, and fixed up the missing generics.</description>
		<content:encoded><![CDATA[<p>Update post, with extra methods, and fixed up the missing generics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leppie</title>
		<link>http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/#comment-3446</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Fri, 06 Mar 2009 16:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://xacc.wordpress.com/?p=209#comment-3446</guid>
		<description>leppie is fine  :)  Sorry for delay been a bit busy at work.</description>
		<content:encoded><![CDATA[<p>leppie is fine  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Sorry for delay been a bit busy at work.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
