<?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: Pattern matching in scheme</title>
	<atom:link href="http://curiousprogrammer.wordpress.com/2006/12/08/pattern-matching-in-scheme/feed/" rel="self" type="application/rss+xml" />
	<link>http://curiousprogrammer.wordpress.com/2006/12/08/pattern-matching-in-scheme/</link>
	<description>Leveraging Perl and Emacs</description>
	<lastBuildDate>Sat, 15 Jun 2013 02:12:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Greg Travis</title>
		<link>http://curiousprogrammer.wordpress.com/2006/12/08/pattern-matching-in-scheme/#comment-221</link>
		<dc:creator><![CDATA[Greg Travis]]></dc:creator>
		<pubDate>Sat, 06 Jan 2007 19:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/2006/12/08/pattern-matching-in-scheme/#comment-221</guid>
		<description><![CDATA[I have been using my own customized version of scheme (it&#039;s a preprocessor).  One of my favorite things is a pattern matching syntax that I modeled superficially on Haskell.  I tried to make it as concise as possible.  It serves both as a destructive 
pattern-matching system, a constructor-based algebraic type system, and an overloading system.

It&#039;s only superficially like Haskell -- it&#039;s of course latently typed, like regular Scheme.  However, I have found it to be incredibly useful.  I also used to have the problem that I wrote Scheme with a &#039;C++ accent&#039;, and this pattern-matching stuff totally cured me of it.

Below is an example of some code implementing linear transformations for various types.

&lt;code&gt;
(fun (scale-to (a . rest) ns)
     (cons (scale-to a ns) (scale-to rest ns)))
(fun (scale-to () ns) &#039;())
(fun (scale-to a ns)
     (scale a (* ns (/ 1.0 (duration a)))))

(fun (union (Extent a b) (Extent &#039;everything)) (Extent &#039;everything))
(fun (union (Extent a b) . rest) (union (Extent a b) (apply union rest)))
(fun (union (Extent &#039;empty) . rest) (apply union rest))
(fun (union) (Extent &#039;empty))

(fun (union (Extent a b) (Extent &#039;empty)) (Extent a b))
(fun (union (Extent &#039;empty) (Extent c d)) (Extent c d))
(fun (union (Extent &#039;empty) (Extent &#039;empty)) (Extent &#039;empty))

(fun (union (Extent &#039;empty) . rest) (apply union rest))
(fun (union (Extent &#039;everything) . rest) (Extent &#039;everything))
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>I have been using my own customized version of scheme (it&#8217;s a preprocessor).  One of my favorite things is a pattern matching syntax that I modeled superficially on Haskell.  I tried to make it as concise as possible.  It serves both as a destructive<br />
pattern-matching system, a constructor-based algebraic type system, and an overloading system.</p>
<p>It&#8217;s only superficially like Haskell &#8212; it&#8217;s of course latently typed, like regular Scheme.  However, I have found it to be incredibly useful.  I also used to have the problem that I wrote Scheme with a &#8216;C++ accent&#8217;, and this pattern-matching stuff totally cured me of it.</p>
<p>Below is an example of some code implementing linear transformations for various types.</p>
<p><code><br />
(fun (scale-to (a . rest) ns)<br />
     (cons (scale-to a ns) (scale-to rest ns)))<br />
(fun (scale-to () ns) '())<br />
(fun (scale-to a ns)<br />
     (scale a (* ns (/ 1.0 (duration a)))))</p>
<p>(fun (union (Extent a b) (Extent 'everything)) (Extent 'everything))<br />
(fun (union (Extent a b) . rest) (union (Extent a b) (apply union rest)))<br />
(fun (union (Extent 'empty) . rest) (apply union rest))<br />
(fun (union) (Extent 'empty))</p>
<p>(fun (union (Extent a b) (Extent 'empty)) (Extent a b))<br />
(fun (union (Extent 'empty) (Extent c d)) (Extent c d))<br />
(fun (union (Extent 'empty) (Extent 'empty)) (Extent 'empty))</p>
<p>(fun (union (Extent 'empty) . rest) (apply union rest))<br />
(fun (union (Extent 'everything) . rest) (Extent 'everything))<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
