<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ian Pedro</title>
    <description>The latest articles on DEV Community by Ian Pedro (@ianpedrov).</description>
    <link>https://dev.to/ianpedrov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F405717%2Fc92a83f8-c4d5-4f20-847e-07997ab19dc1.png</url>
      <title>DEV Community: Ian Pedro</title>
      <link>https://dev.to/ianpedrov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ianpedrov"/>
    <language>en</language>
    <item>
      <title>Starting with Clojure on Windows</title>
      <dc:creator>Ian Pedro</dc:creator>
      <pubDate>Fri, 26 Jun 2020 00:15:55 +0000</pubDate>
      <link>https://dev.to/ianpedrov/starting-with-clojure-on-windows-49f</link>
      <guid>https://dev.to/ianpedrov/starting-with-clojure-on-windows-49f</guid>
      <description>&lt;p&gt;Clojure has been one of the pretty cool things that I've been studying lately. The whole idea of a programming language with a 100% funcional paradigm, seemed to me very strange and challenging. &lt;em&gt;Things got very weird when we get to the syntax&lt;/em&gt;, but that is discussion for another post!&lt;/p&gt;

&lt;p&gt;So, let's cut to the chase: how to prepare your environment using Clojure &lt;em&gt;(specifically leiningen)&lt;/em&gt; + VSCode + Windows.&lt;/p&gt;

&lt;p&gt;Starting out with the dependencies! Well, check if you have all of the shenanigans below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows &lt;em&gt;(makes no sense reading this if you don't use Windows duh)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;Java 8 or 11 (LTS versions). Also need the JAVA_HOME environment set&lt;/li&gt;
&lt;li&gt;Chocolatey (so we get leiningen without putting our hair on fire)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you don't have chocolatey installed, then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run PowerShell as administrator, and execute the following:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Type choco to see if everything went well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, to leiningen! But what is this awesome german guy can do for us? Well, it's porpose is to automate clojure projects. It can: create new projects, fetch dependencies, run a REPL, compile java sources and much more!&lt;/p&gt;

&lt;p&gt;Since you already have chocolatey, with your powershell open, execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;choco install lein
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything went well, you now just need to restart your powershell, and create your project! Go to the the folder you want to keep the project and type in the command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lein new app hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate a project called "hello-word" with the app template.&lt;/p&gt;

&lt;p&gt;Now, we need to open the project with VSCode and install the last need stuff.&lt;/p&gt;

&lt;p&gt;With the project opened, you will see:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FrPgyJeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FrPgyJeg.png" title="Opened the project generated by Leiningen" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To install the extensions, so we can have more funcionatily inside VS, execute shift + ctrl + x, search for clojure and install:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FUDfh5ch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FUDfh5ch.png" title="Searching for clojure extension" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, execute&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;lein repl&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 in the terminal, so the REPL is started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F15TCesN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F15TCesN.png" title="Executing lein repl on terminal" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With that out of the way we just need to connect the running nREPL with VS. Execute shift + ctrl + p, and search for repl, and select:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fnhkmnhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fnhkmnhq.png" title="Searching for nREPL" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press enter twice and &lt;em&gt;voila&lt;/em&gt;, your environment is all set and good to go!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F1hUVvr9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F1hUVvr9.png" title="Shows that VSCode has successfully connected to a REPL" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is very basic, but is enough to get you started. In the next posts I want to show the &lt;em&gt;very weird&lt;/em&gt; syntax, and make a approach on collections! Stay tuned.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
