<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>clojureclr - on code</title>
        <description></description>
        <link>/Tags/clojureclr/RSS</link>
        <language>en</language>
        <image>
            <url>http://suhair.in/Content/icons/flame.png</url>
            <title>on code</title>
            <link>/Tags/clojureclr/RSS</link>
            <width>64</width>
            <height>64</height>
        </image>
        <item>
            <dc:creator>Admin</dc:creator>
            <title>Getting Started with Clojure in .net</title>
            <description>&lt;p&gt;
	Before getting started here is the pre-requisites for installing ClojureCLR&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Microsoft .&lt;span class=&quot;caps&quot;&gt;NET&lt;/span&gt; Framework Version 3.5 SP1&lt;/li&gt;
	&lt;li&gt;
		Visual Studio 2008 SP1&lt;/li&gt;
	&lt;li&gt;
		&lt;a href=&quot;http://dlr.codeplex.com/&quot; target=&quot;_blank&quot;&gt;Dynamic Language Runtime&lt;br /&gt;
		&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;a href=&quot;http://www.nunit.org/index.php?p=home&quot; target=&quot;_blank&quot;&gt;NUnit&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;a href=&quot;http://ayende.com/projects/rhino-mocks/downloads.aspx&quot; target=&quot;_blank&quot;&gt;RhinoMocks&lt;br /&gt;
		&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	These are the steps followed by me for the new installation&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		Created a folder called ClojureCLR&lt;/li&gt;
	&lt;li&gt;
		Downloaded the Dynamic Language Runtime and extracted the DLR_Main folder into the above folder&lt;/li&gt;
	&lt;li&gt;
		Compiled the DLR by opening the visual studio solution file inside DLR_Main&lt;/li&gt;
	&lt;li&gt;
		Downloaded the &lt;a href=&quot;http://github.com/richhickey/clojure-clr/&quot; target=&quot;_blank&quot;&gt;ClojureCLR&lt;/a&gt; by using the git (Windows version can be downloaded &lt;a href=&quot;http://code.google.com/p/msysgit/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;)&amp;nbsp;and Opened the ClojureCLR.sln file&lt;/li&gt;
	&lt;li&gt;
		Added references for NUnit and Rhinomocks (with castle dependencies download from &lt;a href=&quot;http://ayende.com/20/section.aspx/download/227&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;)&amp;nbsp; Clojure.Tests project&lt;/li&gt;
	&lt;li&gt;
		Set Clojure.Main as startup project and then Crl + F5 or F5 will start the interactive Clojure section&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	Clojure is dynamic i.e,&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		Clojure can be embedded in .net applications and can be interacted with&lt;/li&gt;
	&lt;li&gt;
		Can be used as a scripting language inside .net&lt;/li&gt;
	&lt;li&gt;
		Can be interacted with the primary programming interface called Read-Eval-Print (REPL) loop&lt;/li&gt;
	&lt;li&gt;
		Supports dynamic compilation&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	Part of clojure called &lt;em&gt;Reader &lt;/em&gt;will read the clojure program in chunks called forms and translates them in to clojure data structures. when run for the first time, the clojure REPL will display the following prompt.&lt;/p&gt;
&lt;pre class=&quot;prettyprint paper&quot;&gt;&lt;code&gt;
Clojure 1.1.0-alpha-SNAPSHOT
user=&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
	Prompt displays the default namespace and is ready to evaluate the clojure programs. Let&amp;#39;s feed it with a number.&lt;/p&gt;
&lt;pre class=&quot;prettyprint paper&quot;&gt;&lt;code&gt;
Clojure 1.1.0-alpha-SNAPSHOT
user=&amp;gt; 42 &lt;span class=&quot;inlinecode box&quot;&gt;1&lt;/span&gt;
42

user=&amp;gt; (+ 2 3)&lt;span class=&quot;inlinecode box&quot;&gt;2&lt;/span&gt;
5
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
	Number literal &lt;span class=&quot;inlinecode box&quot;&gt;1&lt;/span&gt; is a Form in clojure and evaluates to itself. Let&amp;#39;s feed the REPL with a function that calculates the sum of two numbers &lt;span class=&quot;inlinecode box&quot;&gt;2&lt;/span&gt;. Several deviations from the imperative programming languages are evident from this single expression.&lt;/p&gt;
&lt;p&gt;
	&lt;img align=&quot;top&quot; alt=&quot;&quot; height=&quot;211&quot; src=&quot;http://imgs.xkcd.com/comics/lisp_cycles.png&quot; width=&quot;640&quot; /&gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		All program codes are written in parenthesized lists&lt;/li&gt;
	&lt;li&gt;
		A function call is written as a list with the function or operator&amp;#39;s name (+ in the above code) first, and the arguments following (2 and 3 in above code)&lt;/li&gt;
	&lt;li&gt;
		White space is the commas in Clojure (2 3 in the above code as arguments instead of 2, 3)&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;prettyprint paper&quot;&gt;&lt;code&gt;
Clojure 1.1.0-alpha-SNAPSHOT
user=&amp;gt; (+ 4 6) &lt;span class=&quot;inlinecode box&quot;&gt;3&lt;/span&gt;
10
user=&amp;gt; (- 5 4) &lt;span class=&quot;inlinecode box&quot;&gt;4&lt;/span&gt;
1
user=&amp;gt; (/ 2.0 3) &lt;span class=&quot;inlinecode box&quot;&gt;5&lt;/span&gt;
0.666666666666667
user=&amp;gt; (* 5 6) &lt;span class=&quot;inlinecode box&quot;&gt;6&lt;/span&gt;
30
user=&amp;gt; (inc 4) &lt;span class=&quot;inlinecode box&quot;&gt;7&lt;/span&gt;
5
user=&amp;gt; (dec 4) &lt;span class=&quot;inlinecode box&quot;&gt;8&lt;/span&gt;
3
user=&amp;gt; (quot 12 5) &lt;span class=&quot;inlinecode box&quot;&gt;9&lt;/span&gt;
2
user=&amp;gt; (rem 12 5) &lt;span class=&quot;inlinecode box&quot;&gt;10&lt;/span&gt;
2
user=&amp;gt; (min 2 3 4 1) &lt;span class=&quot;inlinecode box&quot;&gt;11&lt;/span&gt;
1
user=&amp;gt; (max 2 3 4 1) &lt;span class=&quot;inlinecode box&quot;&gt;12&lt;/span&gt;
4

&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
	Add, Subtract, Multiply, Divide, Increment, Decrement, quot[ient] of dividing numerator by denominator, remainder of dividing numerator by denominator, least of the nums and the greatest of the nums are the computations supported by the clojure on Numbers. In addition to the bitwise operations the numbers support the following comparison operations.&lt;/p&gt;
&lt;pre class=&quot;prettyprint paper&quot;&gt;&lt;code&gt;
Clojure 1.1.0-alpha-SNAPSHOT
user=&amp;gt; (== 1 1)
True
user=&amp;gt; (&amp;lt; 1 2)
True
user=&amp;gt; (&amp;lt;= 3 4)
True
user=&amp;gt; (&amp;gt; 3 2)
True
user=&amp;gt; (&amp;gt;= 4 3)
True
user=&amp;gt; (zero? 4)
False
user=&amp;gt; (pos? -2)
False
user=&amp;gt; (neg? -2)
True

&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
	Other data structures will be covered in future posts.&lt;/p&gt;
&lt;p&gt;
	&lt;a href=&quot;http://dotnetshoutout.com/Getting-Started-with-Clojure-in-net-on-code&quot; rev=&quot;vote-for&quot;&gt;&lt;img alt=&quot;Shout it&quot; src=&quot;http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fsuhair.in%2FBlog%2FGetting-Started-with-Clojure-in-net&quot; style=&quot;border: 0px none ;&quot; /&gt;&lt;/a&gt;
&amp;nbsp;
&lt;a href=&quot;http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fsuhair.in%2fBlog%2fGetting-Started-with-Clojure-in-net&quot;&gt;&lt;img src=&quot;http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fsuhair.in%2fBlog%2fGetting-Started-with-Clojure-in-net&quot; border=&quot;0&quot; alt=&quot;kick it on DotNetKicks.com&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;</description>
            <link>http://suhair.in/Blog/Getting-Started-with-Clojure-in-net</link>
            <guid isPermaLink="true">http://suhair.in/Blog/Getting-Started-with-Clojure-in-net</guid>
            <pubDate>Wed, 04 Nov 2009 08:00:00 GMT</pubDate>
            <category>net</category>
            <category>functionalprogramming</category>
            <category>clojure</category>
            <category>clojureclr</category>
        </item>
    </channel>
</rss>
