<?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/"
	
	>
<channel>
	<title>Comments on: Parallel tree scanning by composition</title>
	<atom:link href="http://conal.net/blog/posts/parallel-tree-scanning-by-composition/feed" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition</link>
	<description>Inspirations &#38; experiments, mainly about denotative/functional programming in Haskell</description>
	<lastBuildDate>Sat, 26 Sep 2020 21:06:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.17</generator>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-839</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Fri, 17 Jun 2011 17:41:11 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-839</guid>
		<description><![CDATA[&lt;p&gt;Ryan: Oops! Thanks for the catch. I know the laws hold for depth-typed trees, since they&#039;re tries (and thus isomorphic to functions, which do satisfy the laws), but I haven&#039;t checked the laws for these non-depth-typed trees. I wonder whether they hold with your alteration.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Ryan: Oops! Thanks for the catch. I know the laws hold for depth-typed trees, since they&#8217;re tries (and thus isomorphic to functions, which do satisfy the laws), but I haven&#8217;t checked the laws for these non-depth-typed trees. I wonder whether they hold with your alteration.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; A third view on trees</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-838</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; A third view on trees]]></dc:creator>
		<pubDate>Sat, 04 Jun 2011 02:46:25 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-838</guid>
		<description><![CDATA[&lt;p&gt;[...] About      &#171; Parallel tree scanning by composition [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] About      &laquo; Parallel tree scanning by composition [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ingram</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-837</link>
		<dc:creator><![CDATA[Ryan Ingram]]></dc:creator>
		<pubDate>Wed, 01 Jun 2011 22:09:37 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-837</guid>
		<description><![CDATA[&lt;p&gt;T2&#039;s applicative instance doesn&#039;t follow the applicative laws, though.&lt;/p&gt;

&lt;p&gt;for example:&lt;/p&gt;

&lt;p&gt;pure id &lt;*&gt; x  /=  x&lt;/p&gt;

&lt;p&gt;You can fix this by &#039;cloning&#039; the leaf elements though:&lt;/p&gt;

&lt;p&gt;L2 f &lt;*&gt; B2 (xs :# ys) = B2 (f  xs :# f  ys)&lt;/p&gt;

&lt;p&gt;B2 (fs :# gs) &lt;*&gt; L2 x = B2 (($x)  fs :# ($x)  gs)&lt;/p&gt;

&lt;p&gt;I think a similar trick works for T4.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>T2&#8217;s applicative instance doesn&#8217;t follow the applicative laws, though.</p>

<p>for example:</p>

<p>pure id &lt;*&gt; x  /=  x</p>

<p>You can fix this by &#8216;cloning&#8217; the leaf elements though:</p>

<p>L2 f &lt;*&gt; B2 (xs :# ys) = B2 (f  xs :# f  ys)</p>

<p>B2 (fs :# gs) &lt;*&gt; L2 x = B2 (($x)  fs :# ($x)  gs)</p>

<p>I think a similar trick works for T4.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-836</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Thu, 26 May 2011 05:10:49 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-836</guid>
		<description><![CDATA[&lt;p&gt;Ah, I see. You&#039;re right. I&#039;d forgotten that the &lt;code&gt;Scan&lt;/code&gt; instance for &lt;code&gt;T4&lt;/code&gt; does indeed depend on there being an &lt;code&gt;Applicative&lt;/code&gt; instance. And yes, I&#039;d define it in a zip-like way. Because &lt;code&gt;T4&lt;/code&gt; has a sum and its &lt;code&gt;Applicative&lt;/code&gt; is zip-like, &lt;code&gt;(&lt;*&gt;)&lt;/code&gt; and &lt;code&gt;liftA2&lt;/code&gt; will be partial, which is less than ideal. I hadn&#039;t noticed this issue, because I was working out this algorithm for depth-typed trees, which have no (non-degenerate) sums and hence have total &lt;code&gt;(&lt;*&gt;)&lt;/code&gt; and &lt;code&gt;liftA2&lt;/code&gt;.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Ah, I see. You&#8217;re right. I&#8217;d forgotten that the <code>Scan</code> instance for <code>T4</code> does indeed depend on there being an <code>Applicative</code> instance. And yes, I&#8217;d define it in a zip-like way. Because <code>T4</code> has a sum and its <code>Applicative</code> is zip-like, <code>(&lt;*&gt;)</code> and <code>liftA2</code> will be partial, which is less than ideal. I hadn&#8217;t noticed this issue, because I was working out this algorithm for depth-typed trees, which have no (non-degenerate) sums and hence have total <code>(&lt;*&gt;)</code> and <code>liftA2</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjoerd Visscher</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-835</link>
		<dc:creator><![CDATA[Sjoerd Visscher]]></dc:creator>
		<pubDate>Wed, 25 May 2011 15:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-835</guid>
		<description><![CDATA[&lt;p&gt;The optimized version of prefixScan (B4 t) ends up being (mp, B4 (liftA2 tweak p&#039; t)). Here &quot;liftA2 tweak&quot; lifts tweak to T4, right? And as the liftA2 comes from &quot;zip = uncurry (liftA2 (,))&quot;, I guess a zip-like instance is required?&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>The optimized version of prefixScan (B4 t) ends up being (mp, B4 (liftA2 tweak p&#8217; t)). Here &#8220;liftA2 tweak&#8221; lifts tweak to T4, right? And as the liftA2 comes from &#8220;zip = uncurry (liftA2 (,))&#8221;, I guess a zip-like instance is required?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-834</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Wed, 25 May 2011 14:57:34 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-834</guid>
		<description><![CDATA[&lt;blockquote&gt;
  &lt;p&gt;I think prefixScan for T4 assumes a zip-like applicative instance for T4?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For &lt;code&gt;T4&lt;/code&gt;, &lt;code&gt;prefixScan&lt;/code&gt; is defined simply as &lt;code&gt;prefixScanEnc&lt;/code&gt;, without relying on an &lt;code&gt;Applicative&lt;/code&gt; instance.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Guy Blelloch’s algorithm works on lists of any length, but your T4 trees can only contain 2^n elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.5739&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Programming parallel algorithms&lt;/em&gt;&lt;/a&gt;, 
right above Figure 11 (containing the &lt;code&gt;scan&lt;/code&gt; implementation), Guy says &quot;The particular code shown works only on sequences that have length equal to a power of two, but it is not hard to generalize it to work on sequences of any length.&quot;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;How should T4 be fixed so that can also contain any number of elements?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By using a more flexible data type, such as the binary random-access lists in Chris Okasaki&#039;s &lt;em&gt;Purely Functional Data Structures&lt;/em&gt;, section 9.2.1.
Quoting from that section:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A binary random-access list of size n contains a a tree for each one in the binary representation of n.
  The rank of each tree corresponds to the rank of the corresponding digit;
  if the ith bit of n is one, then the random-access list contains a tree of size 2^i.&lt;/p&gt;
&lt;/blockquote&gt;
]]></description>
		<content:encoded><![CDATA[<blockquote>
  <p>I think prefixScan for T4 assumes a zip-like applicative instance for T4?</p>
</blockquote>

<p>For <code>T4</code>, <code>prefixScan</code> is defined simply as <code>prefixScanEnc</code>, without relying on an <code>Applicative</code> instance.</p>

<blockquote>
  <p>Guy Blelloch’s algorithm works on lists of any length, but your T4 trees can only contain 2^n elements.</p>
</blockquote>

<p>In <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.5739" rel="nofollow"><em>Programming parallel algorithms</em></a>, 
right above Figure 11 (containing the <code>scan</code> implementation), Guy says &#8220;The particular code shown works only on sequences that have length equal to a power of two, but it is not hard to generalize it to work on sequences of any length.&#8221;</p>

<blockquote>
  <p>How should T4 be fixed so that can also contain any number of elements?</p>
</blockquote>

<p>By using a more flexible data type, such as the binary random-access lists in Chris Okasaki&#8217;s <em>Purely Functional Data Structures</em>, section 9.2.1.
Quoting from that section:</p>

<blockquote>
  <p>A binary random-access list of size n contains a a tree for each one in the binary representation of n.
  The rank of each tree corresponds to the rank of the corresponding digit;
  if the ith bit of n is one, then the random-access list contains a tree of size 2^i.</p>
</blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjoerd Visscher</title>
		<link>http://conal.net/blog/posts/parallel-tree-scanning-by-composition#comment-833</link>
		<dc:creator><![CDATA[Sjoerd Visscher]]></dc:creator>
		<pubDate>Wed, 25 May 2011 14:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=429#comment-833</guid>
		<description><![CDATA[&lt;p&gt;I think prefixScan for T4 assumes a zip-like applicative instance for T4?&lt;/p&gt;

&lt;p&gt;Guy Blelloch&#039;s algorithm works on lists of any length, but your T4 trees can only contain 2^n elements. How should T4 be fixed so that can also contain any number of elements?&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I think prefixScan for T4 assumes a zip-like applicative instance for T4?</p>

<p>Guy Blelloch&#8217;s algorithm works on lists of any length, but your T4 trees can only contain 2^n elements. How should T4 be fixed so that can also contain any number of elements?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
