<?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</title>
	<atom:link href="http://yaxu.org/patterns-in-haskell/feed/" rel="self" type="application/rss+xml" />
	<link>http://yaxu.org/patterns-in-haskell/</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: Beats bauen in Syntax &#124; Mururoar &#124; audiophilosophie</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-15147</link>
		<dc:creator>Beats bauen in Syntax &#124; Mururoar &#124; audiophilosophie</dc:creator>
		<pubDate>Thu, 18 Feb 2010 08:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-15147</guid>
		<description><![CDATA[[...] Live coded Music haben wir euch schon mal im Artikel über das Trio Slub näher gebracht. In diesem Video zeigt Alex McLean wie er Sound mittels der Programmiersprache Haskell kreiert. Einen tieferen Einblick in seine Arbeitsweise gewährt Alex hier. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Live coded Music haben wir euch schon mal im Artikel über das Trio Slub näher gebracht. In diesem Video zeigt Alex McLean wie er Sound mittels der Programmiersprache Haskell kreiert. Einen tieferen Einblick in seine Arbeitsweise gewährt Alex hier. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6926</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sun, 28 Jun 2009 22:15:46 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6926</guid>
		<description><![CDATA[Much food for thought, thanks Conal and Ryan.  

Ints made sense to me as a representation of &#039;score time&#039;.  A series of slots where things can go.  To get &#039;performance time&#039; e.g. swing, I add floating point offsets to that.  I have to think more on this though, looking forward to learning more about FRP.

I went for what you point out is ziplist-like behaviour so I could effect particular &#039;levels&#039; in a polymetric pattern.  I think that should probably be done in a more explicit way though.  I&#039;ll respond to your blog post properly soon Ryan.]]></description>
		<content:encoded><![CDATA[<p>Much food for thought, thanks Conal and Ryan.  </p>
<p>Ints made sense to me as a representation of &#8216;score time&#8217;.  A series of slots where things can go.  To get &#8216;performance time&#8217; e.g. swing, I add floating point offsets to that.  I have to think more on this though, looking forward to learning more about FRP.</p>
<p>I went for what you point out is ziplist-like behaviour so I could effect particular &#8216;levels&#8217; in a polymetric pattern.  I think that should probably be done in a more explicit way though.  I&#8217;ll respond to your blog post properly soon Ryan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ingram</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6461</link>
		<dc:creator>Ryan Ingram</dc:creator>
		<pubDate>Thu, 18 Jun 2009 17:22:20 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6461</guid>
		<description><![CDATA[I posted a long response (which ends with a suitable Monad instance for Pattern) here: http://ryani.livejournal.com/19471.html

I don&#039;t like your applicative instance (it is similar to the applicative instance for zip-lists); I think the applicative instance for regular lists makes more sense.  The difference is that [(+1),(+2)]  [3,4], for regular lists is [4,5,5,6], but for ziplists is [4,6].  Still, I can see how you might want to go that direction.

However, you also give special treatment to the &quot;f&quot; argument; if it&#039;s short, the resulting list gets cycled, but if the &quot;x&quot; argument is short, it doesn&#039;t.  I am pretty sure that violates one of the applicative functor laws.  (f &lt;*&gt; pure x = pure ($x) &lt;*&gt; f).]]></description>
		<content:encoded><![CDATA[<p>I posted a long response (which ends with a suitable Monad instance for Pattern) here: <a href="http://ryani.livejournal.com/19471.html" rel="nofollow">http://ryani.livejournal.com/19471.html</a></p>
<p>I don&#8217;t like your applicative instance (it is similar to the applicative instance for zip-lists); I think the applicative instance for regular lists makes more sense.  The difference is that [(+1),(+2)]  [3,4], for regular lists is [4,5,5,6], but for ziplists is [4,6].  Still, I can see how you might want to go that direction.</p>
<p>However, you also give special treatment to the &#8220;f&#8221; argument; if it&#8217;s short, the resulting list gets cycled, but if the &#8220;x&#8221; argument is short, it doesn&#8217;t.  I am pretty sure that violates one of the applicative functor laws.  (f &lt;*&gt; pure x = pure ($x) &lt;*&gt; f).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6458</link>
		<dc:creator>Conal Elliott</dc:creator>
		<pubDate>Thu, 18 Jun 2009 15:44:11 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6458</guid>
		<description><![CDATA[Hi Alex.  Your patterns remind me of FRP also.  The two representations are akin to syntax (algebraic data-type) &amp; semantics.  I think you&#039;ve done what I often like to do as well, which is to program directly with denotations rather than data structures.

There is a hazard in using functions as your representation that took me many years to grok.  Ironically, functional programming is biased against functions and in favor of data structures, in that data structures are automatically memoized, while functions are not.

Typically FRP uses continuous time, unlike your choice of Int, but that choice is not fundamental.  BTW, did you consider continuous &quot;time&quot; here?  Whether time or space, continuous is usually more composable than discrete.  See brief related remarks at http://conal.net/blog/posts/early-inspirations-and-new-directions-in-functional-reactive-programming/ .]]></description>
		<content:encoded><![CDATA[<p>Hi Alex.  Your patterns remind me of FRP also.  The two representations are akin to syntax (algebraic data-type) &amp; semantics.  I think you&#8217;ve done what I often like to do as well, which is to program directly with denotations rather than data structures.</p>
<p>There is a hazard in using functions as your representation that took me many years to grok.  Ironically, functional programming is biased against functions and in favor of data structures, in that data structures are automatically memoized, while functions are not.</p>
<p>Typically FRP uses continuous time, unlike your choice of Int, but that choice is not fundamental.  BTW, did you consider continuous &#8220;time&#8221; here?  Whether time or space, continuous is usually more composable than discrete.  See brief related remarks at <a href="http://conal.net/blog/posts/early-inspirations-and-new-directions-in-functional-reactive-programming/" rel="nofollow">http://conal.net/blog/posts/early-inspirations-and-new-directions-in-functional-reactive-programming/</a> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6407</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 17 Jun 2009 19:04:39 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6407</guid>
		<description><![CDATA[Thanks for looking into my code Ryan and leadnose.  So you mean my monad instance doesn&#039;t conform to the monad laws?  Well at least I&#039;ve learned a lot through trying to make it one. 

I did make Pattern an Applicative instance on the way to the Monad instance:

&lt;pre&gt;&gt; instance Applicative Pattern where
&gt;     pure a = loop $ [a]
&gt;     pf@(Pattern _ n) &lt;*&gt; pa@(Pattern _ n&#039;) = Pattern l (lcm n n&#039;)
&gt;         where l n = map (\(a, b) -&gt; (a b)) $ zip (cycle (at pf n)) (at pa n)&lt;/pre&gt;

... although at the moment I&#039;m not sure what that buys me.  Much to read!

I&#039;ll have a go at Conal&#039;s paper for sure Ryan, interesting that what I&#039;m trying to do is somehow related to FRP, I had no idea.

Good point about a -&gt; Pattern b being useless leadnose.  I was thinking of functions from some particular type to some other particular type, rather than to the same type, but of course they&#039;d have a less general signature than that.  After too long programming perl, this is all still coming together in my head...]]></description>
		<content:encoded><![CDATA[<p>Thanks for looking into my code Ryan and leadnose.  So you mean my monad instance doesn&#8217;t conform to the monad laws?  Well at least I&#8217;ve learned a lot through trying to make it one. </p>
<p>I did make Pattern an Applicative instance on the way to the Monad instance:</p>
<pre>&gt; instance Applicative Pattern where
&gt;     pure a = loop $ [a]
&gt;     pf@(Pattern _ n) &lt;*&gt; pa@(Pattern _ n') = Pattern l (lcm n n')
&gt;         where l n = map (\(a, b) -&gt; (a b)) $ zip (cycle (at pf n)) (at pa n)</pre>
<p>&#8230; although at the moment I&#8217;m not sure what that buys me.  Much to read!</p>
<p>I&#8217;ll have a go at Conal&#8217;s paper for sure Ryan, interesting that what I&#8217;m trying to do is somehow related to FRP, I had no idea.</p>
<p>Good point about a -> Pattern b being useless leadnose.  I was thinking of functions from some particular type to some other particular type, rather than to the same type, but of course they&#8217;d have a less general signature than that.  After too long programming perl, this is all still coming together in my head&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leadnose</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6404</link>
		<dc:creator>leadnose</dc:creator>
		<pubDate>Wed, 17 Jun 2009 17:35:29 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6404</guid>
		<description><![CDATA[A function of type
 a -&gt; Pattern b
doesn&#039;t really make sense, since it would consume anything, and produce a pattern of some other, totally unrelated type. Also not everything needs to be made into a monad (since not everything is one), you can combine things in other ways too. That said, good luck and have fun using Haskell to make music :) This might be of interest to you: http://www.haskell.org/haskore/]]></description>
		<content:encoded><![CDATA[<p>A function of type<br />
 a -&gt; Pattern b<br />
doesn&#8217;t really make sense, since it would consume anything, and produce a pattern of some other, totally unrelated type. Also not everything needs to be made into a monad (since not everything is one), you can combine things in other ways too. That said, good luck and have fun using Haskell to make music :) This might be of interest to you: <a href="http://www.haskell.org/haskore/" rel="nofollow">http://www.haskell.org/haskore/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ingram</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6403</link>
		<dc:creator>Ryan Ingram</dc:creator>
		<pubDate>Wed, 17 Jun 2009 17:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6403</guid>
		<description><![CDATA[Sorry about the formatting, the operator used in Applicative is &lt;*&gt;.  Also, I realized that &quot;fxs&quot; doesn&#039;t quite typecheck, but if you replace ($) with &lt;*&gt;, you get a definition that does!

Also, you may want to look at the Reactive library; I am seeing some striking similarities between what you are defining and that library.  There&#039;s a paper about the library here: http://conal.net/papers/push-pull-frp/]]></description>
		<content:encoded><![CDATA[<p>Sorry about the formatting, the operator used in Applicative is &lt;*&gt;.  Also, I realized that &#8220;fxs&#8221; doesn&#8217;t quite typecheck, but if you replace ($) with &lt;*&gt;, you get a definition that does!</p>
<p>Also, you may want to look at the Reactive library; I am seeing some striking similarities between what you are defining and that library.  There&#8217;s a paper about the library here: <a href="http://conal.net/papers/push-pull-frp/" rel="nofollow">http://conal.net/papers/push-pull-frp/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ingram</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6402</link>
		<dc:creator>Ryan Ingram</dc:creator>
		<pubDate>Wed, 17 Jun 2009 17:04:25 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6402</guid>
		<description><![CDATA[It looks to me like Pattern isn&#039;t *quite* a Monad.  Usually it&#039;s easier to define fmap, join, and return, and use the boilerplate monad instance:

fmapPattern :: (a -&gt; b) -&gt; Pattern a -&gt; Pattern b
returnPattern :: a -&gt; Pattern a
joinPattern :: Pattern (Pattern a) -&gt; Pattern a

instance Functor Pattern where fmap = fmapPattern
instance Monad Pattern where
  return = returnPattern
  m &gt;&gt;= f = joinPattern (fmap f m)

I think it&#039;s likely that Pattern is only an applicative functor, and not a monad:

instance Applicative Pattern where
    pure x = loop [x]
    (Pattern fs pf)  (Pattern xs px) = Pattern fxs (pf*px) where
        fxs n = fs n $ xs n]]></description>
		<content:encoded><![CDATA[<p>It looks to me like Pattern isn&#8217;t *quite* a Monad.  Usually it&#8217;s easier to define fmap, join, and return, and use the boilerplate monad instance:</p>
<p>fmapPattern :: (a -&gt; b) -&gt; Pattern a -&gt; Pattern b<br />
returnPattern :: a -&gt; Pattern a<br />
joinPattern :: Pattern (Pattern a) -&gt; Pattern a</p>
<p>instance Functor Pattern where fmap = fmapPattern<br />
instance Monad Pattern where<br />
  return = returnPattern<br />
  m &gt;&gt;= f = joinPattern (fmap f m)</p>
<p>I think it&#8217;s likely that Pattern is only an applicative functor, and not a monad:</p>
<p>instance Applicative Pattern where<br />
    pure x = loop [x]<br />
    (Pattern fs pf)  (Pattern xs px) = Pattern fxs (pf*px) where<br />
        fxs n = fs n $ xs n</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ix</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6400</link>
		<dc:creator>ix</dc:creator>
		<pubDate>Wed, 17 Jun 2009 15:35:08 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6400</guid>
		<description><![CDATA[motools has various RDF/OWL ontology for describing musical &lt;a href=&quot;http://motools.sourceforge.net/event/event.html&quot; rel=&quot;nofollow&quot;&gt;events&lt;/a&gt; &lt;a href=&quot;http://motools.sourceforge.net/timeline/timeline.html&quot; rel=&quot;nofollow&quot;&gt;timeline&lt;/a&gt; and so on]]></description>
		<content:encoded><![CDATA[<p>motools has various RDF/OWL ontology for describing musical <a href="http://motools.sourceforge.net/event/event.html" rel="nofollow">events</a> <a href="http://motools.sourceforge.net/timeline/timeline.html" rel="nofollow">timeline</a> and so on</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://yaxu.org/patterns-in-haskell/comment-page-1/#comment-6398</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 17 Jun 2009 14:58:55 +0000</pubDate>
		<guid isPermaLink="false">http://yaxu.org/?p=210#comment-6398</guid>
		<description><![CDATA[Hey Douglas!

No I haven&#039;t, I will take a look though, cheers for the tip.  I&#039;ve been meaning to have a proper look at supercollider&#039;s pattern library too, which I think is based on HMSL.]]></description>
		<content:encoded><![CDATA[<p>Hey Douglas!</p>
<p>No I haven&#8217;t, I will take a look though, cheers for the tip.  I&#8217;ve been meaning to have a proper look at supercollider&#8217;s pattern library too, which I think is based on HMSL.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
