<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>cs502</title>
	<atom:link href="http://cs502.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cs502.wordpress.com</link>
	<description>Purdue University Graduate Compilers</description>
	<lastBuildDate>Thu, 12 Jan 2012 04:11:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='cs502.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>cs502</title>
		<link>http://cs502.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://cs502.wordpress.com/osd.xml" title="cs502" />
	<atom:link rel='hub' href='http://cs502.wordpress.com/?pushpress=hub'/>
		<item>
		<title>cs502 Future Weblogs</title>
		<link>http://cs502.wordpress.com/2008/12/04/cs502-future-weblogs/</link>
		<comments>http://cs502.wordpress.com/2008/12/04/cs502-future-weblogs/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 21:32:32 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/?p=25</guid>
		<description><![CDATA[If you have stumbled upon this site, looking for cs502 content, or would like to create a blog for the CS502 class, please email me and I would gladly hand this site over to you.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=25&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have stumbled upon this site, looking for cs502 content, or would like to create a blog for the CS502 class, please email me and I would gladly hand this site over to you.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=25&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2008/12/04/cs502-future-weblogs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
		<item>
		<title>Midterm Re-Review</title>
		<link>http://cs502.wordpress.com/2006/10/16/some-more-of-that-sweet-sweet-review/</link>
		<comments>http://cs502.wordpress.com/2006/10/16/some-more-of-that-sweet-sweet-review/#comments</comments>
		<pubDate>Mon, 16 Oct 2006 18:35:44 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/10/16/some-more-of-that-sweet-sweet-review/</guid>
		<description><![CDATA[Reminder: I have no idea what is on the exam. Like everyone else, I&#8217;m just speculating&#8230; Possible Flow Analyses : Prof Jan Vitek&#8216;s cs510 class has some interesting slides (see any similarities?) Particularly useful ones: Slide 53+ : The Overall Pattern Slide 63: A nice table of the analyses Slide 82+: Interprocedural Analyses (100-102 are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=23&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Reminder:</strong> I have <strong>no idea</strong> what is on the exam. Like everyone else, I&#8217;m just speculating&#8230;</p>
<p>Possible Flow Analyses : Prof <a href="http://www.cs.purdue.edu/homes/jv/">Jan Vitek</a>&#8216;s cs510 class has some interesting <a href="http://www.cs.purdue.edu/homes/jv/courses/510f06/ppa2.pdf">slides</a> (see any similarities?) Particularly useful ones:</p>
<ul>
<li>Slide 53+ : The Overall Pattern</li>
<li>Slide 63: A nice table of the analyses</li>
<li>Slide 82+: Interprocedural Analyses (100-102 are caveats)</li>
</ul>
<p>Possible compiler optimization/analysis that might be on the midterm:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Constant_folding">Constant folding</a></li>
</ul>
<p>Possible Language additions:</p>
<ul>
<li>Introduce &#8220;loop&#8221; primitive</li>
<li>Create overloaded function (like + : ((int * int) -&gt; int) | ((string * string) -&gt; string))</li>
<li>Adding OO constructs to the language (using records, maybe)</li>
<li><a href="http://en.wikipedia.org/wiki/Continuation">Call-cc</a></li>
</ul>
<p>As always, please post your speculations as well. Anyone interested in group <strike>cramming</strike> studying, say this evening 8:00p in LWSN common? (214) for oh for-8096</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=23&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/10/16/some-more-of-that-sweet-sweet-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
		<item>
		<title>Midterm review</title>
		<link>http://cs502.wordpress.com/2006/10/15/midterm-review/</link>
		<comments>http://cs502.wordpress.com/2006/10/15/midterm-review/#comments</comments>
		<pubDate>Sun, 15 Oct 2006 19:35:28 +0000</pubDate>
		<dc:creator>wmrh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/10/15/midterm-review/</guid>
		<description><![CDATA[I went through the lecture slides and jotted down some notes on anything that I was still confused about.  Please feel free to comment on, answer the questions in, or added on to this list of questions: Lecture 3: slide 17: Problem: In class, Prof. Jagannathan challenged us to come up with a case where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=22&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I went through the lecture slides and jotted down some notes on anything that I was still confused about.  Please feel free to comment on, answer the questions in, or added on to this list of questions:</p>
<p>Lecture 3:<br />
slide 17:<br />
Problem: In class, Prof. Jagannathan challenged us to come up with a case where the BFH fails.<br />
Solution (?): given the bool and color datatypes, supply the following patterns:<br />
p1 = (x, red)<br />
p2 = (false, blue)<br />
p3 = (true, green)</p>
<p>The tree generated by the BFH will have 10 nodes.<br />
The optimal tree has 8 nodes.</p>
<p>Is this due to the prescence of variables in the bool position?</p>
<p>Lecture 4:<br />
slide 26: Could &#8220;fn f =&gt; (f(13), f(true))&#8221; work if we could promise that the f passed in will always be over type variables, not concrete types?  Is this the kind of power that explicit type variable systems (which he refers to on slide 9) have?</p>
<p>slide 36:<br />
Question posed: &#8220;What about lists?&#8221;<br />
Answer (?): A box just a pointer, so we would just make a pointer to the list, similar to how we box other non-word-sized data structures</p>
<p>Lecture 7:<br />
slide 10: Question posed: &#8220;How might we identify loops in Core-ML?&#8221;<br />
Answer (?): Label any recursive call as effectively being a loop</p>
<p>Lecture 8:<br />
slide 11: Shouldn&#8217;t the third line of the first example be:<br />
&#8220;in if b then g(13, k) else g(15, k&#8217;)&#8221; ?</p>
<p>Lecture 10:<br />
slide 3: Given that direction is a component of program analysis, how can flow-independent analysis exist?</p>
<p>~Bill Harris</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=22&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/10/15/midterm-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/619e194657bfd5712e999bf3eb7085f9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmrh</media:title>
		</media:content>
	</item>
		<item>
		<title>Project 4-Up! Cps Optimization</title>
		<link>http://cs502.wordpress.com/2006/10/12/project-4-up/</link>
		<comments>http://cs502.wordpress.com/2006/10/12/project-4-up/#comments</comments>
		<pubDate>Fri, 13 Oct 2006 03:11:09 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/10/12/project-4-up/</guid>
		<description><![CDATA[Due: Oct 25, 2006 &#8220;While CPS’ed programs make control-flow explicit, the resulting output is inefficient, and still far removed from the format necessary to enable efficient code generation. For this project, you will simplify CPS programs. While there are many optimizations possible, we will concentrate on particularly important one: Continuations that are not exported via [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=21&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Due: Oct 25, 2006</p>
<p>&#8220;While CPS’ed programs make control-flow explicit, the resulting output is inefficient, and still far removed from the format necessary to enable efficient code generation. For this project, you will simplify CPS programs. While there are many optimizations possible, we will concentrate on particularly important one:<br />
Continuations that are not exported via a Non-Tail call, and which are instantiated<br />
at most once via a Goto, can be inlined at the point of call.&#8221;</p>
<p><a href="http://www.cs.purdue.edu/homes/suresh/502-Fall2006/project/cps-opt.tgz">http://www.cs.purdue.edu/homes/suresh/502-Fall2006/project/cps-opt.tgz</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=21&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/10/12/project-4-up/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
		<item>
		<title>Statistics</title>
		<link>http://cs502.wordpress.com/2006/10/09/statistics/</link>
		<comments>http://cs502.wordpress.com/2006/10/09/statistics/#comments</comments>
		<pubDate>Mon, 09 Oct 2006 21:55:55 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/10/09/statistics/</guid>
		<description><![CDATA[Just thought this was funny.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=19&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just thought this was funny.<br />
<a href="http://www.flickr.com/photos/philschatz/" title="Photo Sharing"><img src="http://static.flickr.com/83/265396173_c9ca0450af.jpg" alt="CS502 website screenshot" height="375" width="500" /></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=19&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/10/09/statistics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>

		<media:content url="http://static.flickr.com/83/265396173_c9ca0450af.jpg" medium="image">
			<media:title type="html">CS502 website screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>More tests!</title>
		<link>http://cs502.wordpress.com/2006/10/09/more-tests/</link>
		<comments>http://cs502.wordpress.com/2006/10/09/more-tests/#comments</comments>
		<pubDate>Mon, 09 Oct 2006 21:53:59 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/10/09/more-tests/</guid>
		<description><![CDATA[These are just some straightforward tests. If anyone has others, please post. Sign up for an account: http://www.wordpress.com . It&#8217;s quick and spam-free! (* The following are a list of my tests * Each are one line (except a few at the bottom * and DO NOT EXECUTE THE ENTIRE FILE at once. *) let [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=20&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>These are just some straightforward tests. If anyone has others, please post. <strong>Sign up for an account:</strong> <a href="http://www.wordpress.com">http://www.wordpress.com</a> . It&#8217;s quick and spam-free!</p>
<pre>
<em><font color="#b22222">(* The following are a list of my tests
 * Each are one line (except a few at the bottom
 * and DO NOT EXECUTE THE ENTIRE FILE at once.
 *)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#a020f0">in</font></strong> 13 <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#a020f0">in</font></strong> f(13) <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*make sure applying f not just returning 13*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> 7 <strong><font color="#a020f0">in</font></strong> f(13) <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*tail and nontail*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">g</font></em></strong></font></strong>(y) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#a020f0">in</font></strong> g <strong><font color="#a020f0">end</font></strong> <strong><font color="#a020f0">in</font></strong> (f(13)) 7 <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*binop*)</font></em>
<strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> x <strong><font color="#5f9ea0">=</font></strong> 4 <strong><font color="#5f9ea0">+</font></strong> 2 <strong><font color="#a020f0">in</font></strong> x <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> 7 <strong><font color="#a020f0">in</font></strong> f(13) <strong><font color="#5f9ea0">+</font></strong> 5 <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> 7 <strong><font color="#a020f0">in</font></strong> 5 <strong><font color="#5f9ea0">+</font></strong> f(13) <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">g</font></em></strong></font></strong>(y) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#5f9ea0">+</font></strong> y <strong><font color="#a020f0">in</font></strong> g <strong><font color="#a020f0">end</font></strong> <strong><font color="#a020f0">in</font></strong> (f(13)) 7 <strong><font color="#a020f0">end</font></strong> <em><font color="#b22222">(*20*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">g</font></em></strong></font></strong>(y) <strong><font color="#5f9ea0">=</font></strong> y <strong><font color="#5f9ea0">+</font></strong> x <strong><font color="#a020f0">in</font></strong> g <strong><font color="#a020f0">end</font></strong> <strong><font color="#a020f0">in</font></strong> (f(13)) 7 <strong><font color="#a020f0">end</font></strong> <em><font color="#b22222">(*20*)</font></em>
<em><font color="#b22222">(*anon funcs*)</font></em>
<strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> (<strong><font color="#a020f0">fn</font></strong>(x) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> x) 13
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> (<strong><font color="#a020f0">fn</font></strong>(y) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> y <strong><font color="#5f9ea0">+</font></strong> x) <strong><font color="#a020f0">in</font></strong> (f(13)) 7 <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*Unary funcs*)</font></em>
<strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> ~(1 <strong><font color="#5f9ea0">+</font></strong> 3)
<em><font color="#b22222">(*tuple*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> 1 <strong><font color="#5f9ea0">+</font></strong> x <strong><font color="#a020f0">in</font></strong> (f(13), f(14), f(7), f(5)) <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*Subscripts*)</font></em>
<strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> #2 (5, 6, 7)
<em><font color="#b22222">(*refs and order-of-eval-in-tuples/binops*)</font></em>
<strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#5f9ea0">!</font></strong> (<strong><font color="#a020f0">ref</font></strong> 0)
<strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> r <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">ref</font></strong> 0 <strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> (r <strong><font color="#5f9ea0">:=</font></strong> 1) <strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> (r <strong><font color="#5f9ea0">:=</font></strong> 2) <strong><font color="#a020f0">in</font></strong> <strong><font color="#5f9ea0">!</font></strong>r <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(* Should the following return 1 or 2? *)</font></em>
<strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> r <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">ref</font></strong> 1
<strong><font color="#a020f0">    fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">setTwo</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong>
      <strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> (r <strong><font color="#5f9ea0">:=</font></strong> 2)
      <strong><font color="#a020f0">in</font></strong> 0
      <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">in</font></strong> <strong><font color="#5f9ea0">!</font></strong>r <strong><font color="#5f9ea0">+</font></strong> setTwo()
<strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(* Should the following return 1 or 2? *)</font></em>
<strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> r <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">ref</font></strong> 1
<strong><font color="#a020f0">    fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">setTwo</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong>
      <strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> _ <strong><font color="#5f9ea0">=</font></strong> (r <strong><font color="#5f9ea0">:=</font></strong> 2)
      <strong><font color="#a020f0">in</font></strong> 0
      <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">in</font></strong> setTwo() <strong><font color="#5f9ea0">+</font></strong> <strong><font color="#5f9ea0">!</font></strong>r
<strong><font color="#a020f0">end</font></strong>

<strong><font color="#a020f0">let</font></strong> <strong><font color="#a020f0">val</font></strong> r <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">ref</font></strong> 1
<strong><font color="#a020f0">    fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">two</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> (r <strong><font color="#5f9ea0">:=</font></strong> 2)
<strong><font color="#a020f0">    fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">five</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> (r <strong><font color="#5f9ea0">:=</font></strong> 5)
<strong><font color="#a020f0">in</font></strong> (<strong><font color="#5f9ea0">!</font></strong>r, two(), <strong><font color="#5f9ea0">!</font></strong>r, five(), <strong><font color="#5f9ea0">!</font></strong>r)
<strong><font color="#a020f0">end</font></strong>

<em><font color="#b22222">(*ifthenelse*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">fact</font></em></strong></font></strong>(n) <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">if</font></strong> n &lt; 1 <strong><font color="#a020f0">then</font></strong> 1 <strong><font color="#a020f0">else</font></strong> n <strong><font color="#5f9ea0">*</font></strong> fact(n<strong><font color="#5f9ea0">-</font></strong>1) <strong><font color="#a020f0">in</font></strong> fact(4) <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*Datatypes*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">iotaHelper</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong>
      (<strong><font color="#a020f0">case</font></strong> x
         <strong><font color="#a020f0">of</font></strong> (0,l) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> l
          <strong><font color="#5f9ea0">|</font></strong> (n,l) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> iotaHelper(n<strong><font color="#5f9ea0">-</font></strong>1,Cons(n,l)))
<strong><font color="#a020f0">in</font></strong> iotaHelper(3,Nil)
<strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(* Non-exhaustive Case tests: *)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">test</font></em></strong></font></strong>(p) <strong><font color="#5f9ea0">=</font></strong>
      <strong><font color="#a020f0">case</font></strong> p
        <strong><font color="#a020f0">of</font></strong> 0 <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> 0 

<strong><font color="#a020f0">in</font></strong> (test 0)
<strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(* at this point you can try test-map.mml
 * SUGGESTION: change the noisy flag to false (cps-interp.sml line 382)
 * Otherwise, you'll be sitting around for hours ; )
 *)</font></em></pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=20&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/10/09/more-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
		<item>
		<title>My $.03 on Project 3</title>
		<link>http://cs502.wordpress.com/2006/10/04/project-3-overview/</link>
		<comments>http://cs502.wordpress.com/2006/10/04/project-3-overview/#comments</comments>
		<pubDate>Wed, 04 Oct 2006 07:30:17 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/10/04/project-3-overview/</guid>
		<description><![CDATA[Anyone else done with Project 3? If not and you want to meet, give me a call: (214) 404-8096. Until then I’ll post some thoughts on the project. Allthe work is in cps.sml&#8217;s cps function. Basically, you&#8217;re just connecting work you recursively did with the current computation (whether it&#8217;s a binop, apply, tuple, etc) The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=18&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Anyone else done with Project 3? If not and you want to meet, give me a call: (214) 404-8096. Until then I’ll post some thoughts on the project.<br />
Allthe work is in cps.sml&#8217;s cps function. Basically, you&#8217;re just connecting work you recursively did with the current computation (whether it&#8217;s a binop, apply, tuple, etc)</p>
<p>The cps function has 3 args: ce, ko, and kl. Now you may be wondering &#8220;Well when the heck do I use ko and kl??&#8221; That&#8217;s easy:</p>
<ul>
<li>ko : this will be <code>NONE</code> when there is nothing left to do after computing <code>ce</code></li>
<li>kl : this is <strong>ALWAYS</strong> appended to, and <strong>NEVER</strong> removed from. You will have to append every continuation created to it</li>
</ul>
<p>Suggested ordering for implementing the body of cps:</p>
<ol>
<li><code>LetRec</code> : Simple <code>let fun ...</code> without applications.</li>
<li><code>App</code> : Get <code>Tail</code> and <code>NonTail</code> working. This should be the first time you&#8217;ll create a continuation. So you&#8217;ll need: <code>Label, Id, RetVal, Ret</code>. make sure you prepend the cont you created before returning!</li>
<li><code>BinOp, UnOp</code> : The tough part&#8217;s done (assuming you tested app thoroughly) so these should two should be a breeze. <strong>Notes:</strong> Take advantage of <code>buildSimpleCont</code>. You can&#8217;t test if you are evaluating binops correctly until you have <code>ref</code>&#8216;s done</li>
<li><code>Fn</code></li>
<li><code>Tuple</code> : Here, I used <code>List.foldr</code> 3 times <strong>Notes:</strong> Take advantage of <code>buildSimpleCont</code>. You can&#8217;t test if you are evaluating tuples in the right order until you can create side-effects</li>
<li><code>Ith, SetIth</code> : These are needed for refs</li>
<li>Retest Binops and Tuples. Create a test and run it in SML/NJ and compare. <strong>Note:</strong> Assignments in MiniML don&#8217;t return unit.</li>
<li><code>If</code></li>
<li><code>Constructor</code></li>
<li><code>Error</code></li>
</ol>
<p>Once you decide to try out <code>test-map.mml</code> I&#8217;d suggest unsetting the noisy flag (cps-interp.sml line 382). Otherwise you&#8217;ll be sitting around for hours waiting for the compiler to print.</p>
<p>Some tests to get started:</p>
<pre><strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#a020f0">in</font></strong> 13 <strong><font color="#a020f0">end</font></strong>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#a020f0">in</font></strong> f(13) <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*make sure applying f not just returning 13*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> 7 <strong><font color="#a020f0">in</font></strong> f(13) <strong><font color="#a020f0">end</font></strong>
<em><font color="#b22222">(*tail and nontail*)</font></em>
<strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">f</font></em></strong></font></strong>(x) <strong><font color="#5f9ea0">=</font></strong> <strong><font color="#a020f0">let</font></strong><strong><font color="#a020f0"> fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">g</font></em></strong></font></strong>(y) <strong><font color="#5f9ea0">=</font></strong> x <strong><font color="#a020f0">in</font></strong> g <strong><font color="#a020f0">end</font></strong> <strong><font color="#a020f0">in</font></strong> (f(13)) 7 <strong><font color="#a020f0">end</font></strong><em><font color="#b22222">
</font></em></pre>
<p>Happy coding!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=18&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/10/04/project-3-overview/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
		<item>
		<title>Lecture Notes 1 (Data Types &amp; Pattern Matching)</title>
		<link>http://cs502.wordpress.com/2006/09/27/lecture-notes/</link>
		<comments>http://cs502.wordpress.com/2006/09/27/lecture-notes/#comments</comments>
		<pubDate>Wed, 27 Sep 2006 21:46:20 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[scribe]]></category>

		<guid isPermaLink="false">http://cs502.wordpress.com/2006/09/27/lecture-notes/</guid>
		<description><![CDATA[Data Types In MiniML: bool, int option, int list datatype shape = Circle of real * real * real Recursive Types Context-free Grammar Inductive (leaves are just ints) Using Abstraction Fold is your friend! fold takes a list, state (accumulator), and a folder. internal function loop. base case: empty list induction step: apply folder to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=16&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Data Types</h3>
<p>In MiniML: <code>bool</code>, <code>int option</code>, <code>int list</code></p>
<pre>
<strong><font color="#a020f0">datatype</font></strong> shape <strong><font color="#5f9ea0">=</font></strong> Circle <strong><font color="#a020f0">of</font></strong> <strong><font color="#228b22">real</font></strong> <strong><font color="#5f9ea0">*</font></strong> <strong><font color="#228b22">real</font></strong> <strong><font color="#5f9ea0">*</font></strong> <strong><font color="#228b22">real</font></strong></pre>
<h3>Recursive Types</h3>
<ul>
<li>Context-free Grammar</li>
<li>Inductive (leaves are just ints)</li>
</ul>
<h3>Using Abstraction</h3>
<p>Fold is your friend! <code>fold</code> takes a list, state (accumulator), and a folder.</p>
<p>internal function loop.</p>
<p>base case: empty list</p>
<p>induction step: apply folder to (head, state), and recursively call loop on the tail</p>
<p>map:</p>
<h3>Generative Datatypes</h3>
<h3>Pattern Matching</h3>
<p>like switches except not just on ints (or enums)</p>
<p>can be:</p>
<pre>
<strong><font color="#a020f0">case</font></strong> s
  <strong><font color="#a020f0">of</font></strong> x <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e1 <em><font color="#b22222">(* any subject matches this pattern *)</font></em>
   <strong><font color="#5f9ea0">|</font></strong> _ <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e2 <em><font color="#b22222">(* same as x but discarded *)</font></em>
   <strong><font color="#5f9ea0">|</font></strong> 3 <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e3 <em><font color="#b22222">(* matches when s = 3 *)</font></em>
   <strong><font color="#5f9ea0">|</font></strong> (p1, p2, pn) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e4 <em><font color="#b22222">(* provided s is a tuple
                         * and the correct arity
                         * (guaranteed already by
                         *  the type checker)
                         * pn can be a pattern
                         *)</font></em>
   <strong><font color="#5f9ea0">|</font></strong> C y <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e5 <em><font color="#b22222">(* Matches Constructor AND
                * y can be a tuple, constructor,
                * record, etc.
                *)</font></em></pre>
<h3>Quirks</h3>
<pre>
<strong><font color="#a020f0">case</font></strong> s
  <strong><font color="#a020f0">of</font></strong> (1, 2) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e1
   <strong><font color="#5f9ea0">|</font></strong> (1, 3) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e2</pre>
<p>A naive compiler would ask &#8220;Is the 1st element 1?&#8221; twice. In general, this is NP complete.</p>
<h3>Infeasible/Silly</h3>
<pre>
<strong><font color="#a020f0">case</font></strong> s
  <strong><font color="#a020f0">of</font></strong> x <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e1
   <strong><font color="#5f9ea0">|</font></strong> 3 <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e2</pre>
<p>x will always match</p>
<pre>
<strong><font color="#a020f0">fun </font></strong><strong><font color="#0000ff"><strong><em><font color="#000000">diff</font></em></strong></font></strong>(nil, y) <strong><font color="#5f9ea0">=</font></strong> y(1)
  <strong><font color="#5f9ea0">|</font></strong> diff(x, nil) <strong><font color="#5f9ea0">=</font></strong> x(1)</pre>
<p>Overlapping <code>(nil, nil)</code> so y(1) will never be executed.</p>
<h3>Questions?</h3>
<pre>
<strong><font color="#a020f0">case</font></strong> s
  <strong><font color="#a020f0">of</font></strong> Cons(x)      <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e <em><font color="#b22222">(* 1-tuple = variable *)</font></em>
   <strong><font color="#5f9ea0">|</font></strong> Cons(y, nil) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e <em><font color="#b22222">(* redundant *)</font></em></pre>
<p>One cannot call functions ins a pattern, or match on the value of a ref. However, SML lists can be deconstructed using <code>::</code> as in the following:</p>
<pre>
<strong><font color="#a020f0">case</font></strong> s
  <strong><font color="#a020f0">of</font></strong> []         <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e <em><font color="#b22222">(* empty list *)</font></em>
   <strong><font color="#5f9ea0">|</font></strong> <strong><font color="#5f9ea0">hd</font></strong> <strong><font color="#5f9ea0">::</font></strong> tail <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e <em><font color="#b22222">(* non-empty list *)</font></em></pre>
<h3>Example</h3>
<pre>
<strong><font color="#a020f0">case</font></strong> s : (<strong><font color="#228b22">bool</font></strong> <strong><font color="#5f9ea0">*</font></strong> intlist)
  <strong><font color="#a020f0">of</font></strong> (true, _)            <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> p1
   <strong><font color="#5f9ea0">|</font></strong> (false, nil)         <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> p2
   <strong><font color="#5f9ea0">|</font></strong> (false, Cons(x,Nil)) <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> p3
   <strong><font color="#5f9ea0">|</font></strong> (false, Cons(y,z))   <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> p4</pre>
<h4>Is the order of matching important?</h4>
<p>If the ordering is right to left, then the correct match will not happen until both arguments are matched (since <code>_</code> is the wildcard)</p>
<h4>Are p3, p4 redundant?</h4>
<p>No, because p3 is more specific but overlapping. It matches specifically Nil while p4&#8242;s last argument matches anything and assigns the value to y</p>
<h4>Is <code><strong><font color="#a020f0">case</font></strong> s <strong><font color="#a020f0">of</font></strong> x <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e <strong><font color="#5f9ea0">|</font></strong> 3 <strong><font color="#5f9ea0">=</font></strong><strong><font color="#5f9ea0">&gt;</font></strong> e</code> redundant?</h4>
<p>Yes, because x will always match because of ordering and 3 will never</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=16&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/09/27/lecture-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
		<item>
		<title>Some insight for absolute ML beginner</title>
		<link>http://cs502.wordpress.com/2006/08/30/some-insight-for-absolute-ml-beginner/</link>
		<comments>http://cs502.wordpress.com/2006/08/30/some-insight-for-absolute-ml-beginner/#comments</comments>
		<pubDate>Wed, 30 Aug 2006 19:47:21 +0000</pubDate>
		<dc:creator>jcchin</dc:creator>
				<category><![CDATA[project]]></category>

		<guid isPermaLink="false">https://cs502.wordpress.com/2006/08/30/some-insight-for-absolute-ml-beginner/</guid>
		<description><![CDATA[Here&#8217;s some random stuff I found useful after discussing with Phil on &#8220;how to start writing ML.&#8221; 1. use eval_be to handle binary operations and eval_ue for unary operations. 2. use conv() to handle A.Const_e and A.DataCon_e 3. patMatch() basically handle two cases: &#8220;Let val &#8230;&#8221; and &#8220;case &#8230; of &#8230;&#8221; both of these requires pattern [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=14&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some random stuff I found useful after discussing with Phil on &#8220;how to start writing ML.&#8221;</p>
<p>1. use eval_be to handle binary operations and eval_ue for unary operations.</p>
<p>2. use conv() to handle A.Const_e and A.DataCon_e</p>
<p>3. patMatch() basically handle two cases: &#8220;Let val &#8230;&#8221; and &#8220;case &#8230; of &#8230;&#8221; both of these requires pattern matching (that&#8217;s why it is there).</p>
<p>4. Before you handling A.Let_e(A.Val_d(&#8230;)) in patMatch, it is a good idea to study how A.Case_e() works in patMatch. That should give you some hint on how to proceed.</p>
<p>5. Don&#8217;t worry about the A.Id_t(&#8220;pat&#8221;) or A.Id_t(&#8220;patType&#8221;) that you found in interp.sml. They are not used at all.</p>
<p>6. <a href="http://www.standardml.org/Basis/list-pair.html">http://www.standardml.org/Basis/list-pair.html</a> contains useful function to use when handling A.Tuple_p and A.Record_p in pat_compile. Specifically you need to walk down the tuple/records and perform matching one by one. ListPair is different from List where ListPair walk down two lists simultaneously (your root and p) whereas List do the same thing on one list.</p>
<p>7. Lastly, the assignment statement &#8220;x := 3&#8243; returns a unit &#8220;()&#8221;.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=14&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/08/30/some-insight-for-absolute-ml-beginner/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02113a491e47e66fe69693732dad64e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jcchin</media:title>
		</media:content>
	</item>
		<item>
		<title>Phil&#8217;s Status</title>
		<link>http://cs502.wordpress.com/2006/08/29/phils-status/</link>
		<comments>http://cs502.wordpress.com/2006/08/29/phils-status/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 04:23:13 +0000</pubDate>
		<dc:creator>Philip Schatz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://cs502.wordpress.com/2006/08/29/phils-status/</guid>
		<description><![CDATA[I&#8217;m leaving the country Tuesday Aug 29 until Sept 21. JC has volunteered to add everyone who wishes to contribute to the projects posts and post scribe notes while I&#8217;m gone. Best of luck!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=13&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m leaving the country Tuesday Aug 29 until Sept 21. JC has volunteered to add everyone who wishes to contribute to the projects posts and post scribe notes while I&#8217;m gone.</p>
<p>Best of luck!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cs502.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cs502.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cs502.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cs502.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cs502.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cs502.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cs502.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cs502.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cs502.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cs502.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cs502.wordpress.com&amp;blog=371359&amp;post=13&amp;subd=cs502&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cs502.wordpress.com/2006/08/29/phils-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/230b534963782ec45db2e2dbf8bf6709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philschatz</media:title>
		</media:content>
	</item>
	</channel>
</rss>
