<?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/"
	>

<channel>
	<title>CodeMocha &#187; fibonacci</title>
	<atom:link href="http://codemocha.com/tag/fibonacci/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemocha.com</link>
	<description>Freshly ground code.  Thoughts on software and algorithms by Chet Mancini</description>
	<lastBuildDate>Fri, 18 Sep 2009 15:22:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Recursive Fibonacci</title>
		<link>http://codemocha.com/2009/07/recursive-fibonacci/</link>
		<comments>http://codemocha.com/2009/07/recursive-fibonacci/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 03:40:28 +0000</pubDate>
		<dc:creator>Chet</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[college]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[ml]]></category>
		<category><![CDATA[recusion]]></category>

		<guid isPermaLink="false">http://codemocha.com/?p=7</guid>
		<description><![CDATA[Here are two recursive fibonacci functions in ML I did for CS243.  Can you tell which one is more efficient?
123456789101112fun fibonacci&#40;n&#41; = 
&#160; let
&#160; &#160; &#160; fun fib&#40;&#40;a, b&#41;, i&#41;= &#160;
&#160; &#160; if i=0 then b
&#160; &#160; &#160; &#160; else fib&#40;&#40;b, a + b&#41;, i-1&#41;;
&#160; &#160; &#160; &#160; &#160; &#160;in
&#160; fib&#40;&#40;0, 1&#41;, n&#41;
&#160; end;

fun [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two recursive fibonacci functions in ML I did for CS243.  Can you tell which one is more efficient?<span id="more-7"></span></p>
<div class="codecolorer-container ocaml vibrant" style="overflow:auto;white-space:nowrap;width:600px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="ocaml codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">fun</span> fibonacci<span class="br0">&#40;</span>n<span class="br0">&#41;</span> <span class="sy0">=</span> <br />
&nbsp; <span class="kw1">let</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">fun</span> fib<span class="br0">&#40;</span><span class="br0">&#40;</span>a, b<span class="br0">&#41;</span>, i<span class="br0">&#41;</span><span class="sy0">=</span> &nbsp;<br />
&nbsp; &nbsp; <span class="kw1">if</span> i<span class="sy0">=</span><span class="nu0">0</span> <span class="kw1">then</span> b<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> fib<span class="br0">&#40;</span><span class="br0">&#40;</span>b, a <span class="sy0">+</span> b<span class="br0">&#41;</span>, i<span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">in</span><br />
&nbsp; fib<span class="br0">&#40;</span><span class="br0">&#40;</span><span class="nu0">0</span>, <span class="nu0">1</span><span class="br0">&#41;</span>, n<span class="br0">&#41;</span><br />
&nbsp; <span class="kw1">end</span><span class="sy0">;</span><br />
<br />
<span class="kw1">fun</span> fibonacci<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span> <span class="sy0">=</span> <span class="nu0">1</span><br />
&nbsp; <span class="sy0">|</span> fibonacci<span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="sy0">=</span> <span class="nu0">1</span><br />
&nbsp; <span class="sy0">|</span> fibonacci<span class="br0">&#40;</span>n<span class="br0">&#41;</span> <span class="sy0">=</span> fibonacci<span class="br0">&#40;</span>n<span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="sy0">+</span> fibonacci<span class="br0">&#40;</span>n<span class="sy0">-</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="sy0">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://codemocha.com/2009/07/recursive-fibonacci/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
