<?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"
	>
<channel>
	<title>Comments on: Learning Haskell</title>
	<atom:link href="http://evanlenz.net/blog/2007/06/12/learning-haskell/feed/" rel="self" type="application/rss+xml" />
	<link>http://evanlenz.net/blog/2007/06/12/learning-haskell/</link>
	<description>XSLT et cetera</description>
	<pubDate>Thu, 04 Dec 2008 22:48:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Evan</title>
		<link>http://evanlenz.net/blog/2007/06/12/learning-haskell/#comment-41008</link>
		<dc:creator>Evan</dc:creator>
		<pubDate>Thu, 14 Jun 2007 18:41:22 +0000</pubDate>
		<guid isPermaLink="false">http://evanlenz.net/blog/2007/06/12/learning-haskell/#comment-41008</guid>
		<description>Hi Joshua,

Thanks for pointing out my impreciseness. I guess I meant "thanks to the fact that we can partially apply curried functions". Or am I still misusing the word "curry" even there? I'm still working on getting all the jargon right. :-)

As for your generalized fold, I'm sure I'll be referring back to it for inspiration, even if I don't fully understand it now.

I've posted another Haskell post already. On Monday, I start a new computer music class, so I'm not sure how many more of these I'll have time to do in the near future. But I might still sneak one or two in. Keep the comments coming! 

Evan</description>
		<content:encoded><![CDATA[<p>Hi Joshua,</p>
<p>Thanks for pointing out my impreciseness. I guess I meant &#8220;thanks to the fact that we can partially apply curried functions&#8221;. Or am I still misusing the word &#8220;curry&#8221; even there? I&#8217;m still working on getting all the jargon right. <img src='http://evanlenz.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>As for your generalized fold, I&#8217;m sure I&#8217;ll be referring back to it for inspiration, even if I don&#8217;t fully understand it now.</p>
<p>I&#8217;ve posted another Haskell post already. On Monday, I start a new computer music class, so I&#8217;m not sure how many more of these I&#8217;ll have time to do in the near future. But I might still sneak one or two in. Keep the comments coming! </p>
<p>Evan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Ball</title>
		<link>http://evanlenz.net/blog/2007/06/12/learning-haskell/#comment-41007</link>
		<dc:creator>Joshua Ball</dc:creator>
		<pubDate>Thu, 14 Jun 2007 03:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://evanlenz.net/blog/2007/06/12/learning-haskell/#comment-41007</guid>
		<description>I think you mean partial application, not currying.

An open question on MY mind which you have brought up is this: What would a fold look like on church numerals?

Just for fun, here is a generalization of the fold function:
gfoldr :: (c -&#62; Maybe a) -&#62; (c -&#62; c) -&#62; (a -&#62; b -&#62; b) -&#62; b -&#62; c -&#62; b
gfoldr first rest f z d 
  &#124; isNothing $ first d = z
  &#124; otherwise = f (fromJust $ first d) (gfoldr first rest f z (rest d))

And it's application to lists (equivalent to foldr in the Prelude):
foldrList = gfoldr safeHead tail where
  safeHead [] = Nothing
  safeHead (x:xs) = Just x

And it's application to numbers (your definition):
foldrNumber = gfoldr (\x -&#62; if x == 0 then Nothing else Just x) (+(-1))</description>
		<content:encoded><![CDATA[<p>I think you mean partial application, not currying.</p>
<p>An open question on MY mind which you have brought up is this: What would a fold look like on church numerals?</p>
<p>Just for fun, here is a generalization of the fold function:<br />
gfoldr :: (c -&gt; Maybe a) -&gt; (c -&gt; c) -&gt; (a -&gt; b -&gt; b) -&gt; b -&gt; c -&gt; b<br />
gfoldr first rest f z d<br />
  | isNothing $ first d = z<br />
  | otherwise = f (fromJust $ first d) (gfoldr first rest f z (rest d))</p>
<p>And it&#8217;s application to lists (equivalent to foldr in the Prelude):<br />
foldrList = gfoldr safeHead tail where<br />
  safeHead [] = Nothing<br />
  safeHead (x:xs) = Just x</p>
<p>And it&#8217;s application to numbers (your definition):<br />
foldrNumber = gfoldr (\x -&gt; if x == 0 then Nothing else Just x) (+(-1))</p>
]]></content:encoded>
	</item>
</channel>
</rss>
