<?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: Patterns in Haskell revisited</title>
	<atom:link href="http://yaxu.org/patterns-in-haskell-revisited/feed/" rel="self" type="application/rss+xml" />
	<link>http://yaxu.org/patterns-in-haskell-revisited/</link>
	<description>Making music with text</description>
	<lastBuildDate>Thu, 04 Apr 2013 04:14:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Alex</title>
		<link>http://yaxu.org/patterns-in-haskell-revisited/comment-page-1/#comment-103896</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 06 Mar 2012 19:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=917#comment-103896</guid>
		<description><![CDATA[Great tip, thanks Noah!]]></description>
		<content:encoded><![CDATA[<p>Great tip, thanks Noah!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noah Easterly</title>
		<link>http://yaxu.org/patterns-in-haskell-revisited/comment-page-1/#comment-103893</link>
		<dc:creator>Noah Easterly</dc:creator>
		<pubDate>Tue, 06 Mar 2012 19:00:13 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=917#comment-103893</guid>
		<description><![CDATA[Cool stuff.  I&#039;d note that both `length xs` and `xs !! x` are O(n), so that makes `toPattern :: [a] -&gt; Pattern a` O(n^2), but it doesn&#039;t have to be.  You can look the length up once, and use `zipWith` to iterate through your elements

&lt;pre&gt;
    instance Patternable [] where
        toPattern xs = Cycle ps
          where
            n = length xs
            ps = zipWith mkArc xs [0..]
            mkArc x i = Arc  x ((fromIntegral i) / (fromIntegral n)) Nothing
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Cool stuff.  I&#8217;d note that both `length xs` and `xs !! x` are O(n), so that makes `toPattern :: [a] -&gt; Pattern a` O(n^2), but it doesn&#8217;t have to be.  You can look the length up once, and use `zipWith` to iterate through your elements</p>
<pre>
    instance Patternable [] where
        toPattern xs = Cycle ps
          where
            n = length xs
            ps = zipWith mkArc xs [0..]
            mkArc x i = Arc  x ((fromIntegral i) / (fromIntegral n)) Nothing
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
