<?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>Ramblings of a Coder&#039;s Mind &#187; F#</title>
	<atom:link href="http://karunab.com/tag/f/feed/" rel="self" type="application/rss+xml" />
	<link>http://karunab.com</link>
	<description>Got Tech? Will Hack.</description>
	<lastBuildDate>Thu, 06 Oct 2011 10:48:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>First hand at F#</title>
		<link>http://karunab.com/2009/05/24/first-hand-at-f/</link>
		<comments>http://karunab.com/2009/05/24/first-hand-at-f/#comments</comments>
		<pubDate>Sun, 24 May 2009 12:21:36 +0000</pubDate>
		<dc:creator>Karun</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://karunab.com/?p=219</guid>
		<description><![CDATA[With the release of the first beta of Visual Studio 2010 which includes support for F#, it was only a matter of time till I tried my hand at it. I don&#8217;t go for Hello World programs. Apart from C, the first code I&#8217;ve written in every other language (since I heard this question) has <a href='http://karunab.com/2009/05/24/first-hand-at-f/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>With the release of the first beta of Visual Studio 2010 which includes support for F#, it was only a matter of time till I tried my hand at it.</p>
<p>I don&#8217;t go for Hello World programs. Apart from C, the first code I&#8217;ve written in every other language (since I heard this question) has been the same. Keeping up tradition, here&#8217;s the F# port.</p>
<p style="padding-left: 30px;">let Check (x: int) = float(int(sqrt(float x))) = sqrt(float x)<br />
for x = 32 to 99 do<br />
let sqVal = pown x 2<br />
if (Check(sqVal / 100) &amp;&amp; Check(sqVal % 100)) then<br />
System.Console.WriteLine(sqVal);<br />
done</p>
<p>This code aims to find every 4 digit number that is a perfect square whose upper and lower two digits are both perfect squares. This question was part of my sem 1 C paper and got me a 0/10. Clearly the examiner didn&#8217;t understand my answer. :P In honor of the great act of stupidity on my side (of writing such a solution in an exam), I recreate this in every concievable language as my first code :)</p>
<p>This is my first piece of code in a functional language so if I could have done this better, please let me know. Now to try out Haskell :)</p>
<p>A note about the VS 2010 F# editor. I know its not meant for performance but compiling clearly takes a couple of seconds. The IDE also could do with a bit more work with its intellisense because it didn&#8217;t like remembering System.Console and instead searched for the string everytime meaning I would hit System.Configuration instead (I am used to hitting enter after &#8216;Con&#8217; due to C# :))</p>
]]></content:encoded>
			<wfw:commentRss>http://karunab.com/2009/05/24/first-hand-at-f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

