<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Learning OCaml]]></title><description><![CDATA[Documenting the journey with OCaml]]></description><link>https://ocaml-learning-journey.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 09:41:08 GMT</lastBuildDate><atom:link href="https://ocaml-learning-journey.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[I thought to start this off with a book...]]></title><description><![CDATA[Free online access —> https://dev.realworldocaml.org/index.html
I love how the book starts off with “programming languages matter”; I agree with this, 100%, as a pdeveloper of cybersecurity products.
I need to find some up-to-date coding practices/re...]]></description><link>https://ocaml-learning-journey.hashnode.dev/i-thought-to-start-this-off-with-a-book</link><guid isPermaLink="true">https://ocaml-learning-journey.hashnode.dev/i-thought-to-start-this-off-with-a-book</guid><category><![CDATA[ocaml]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Shu]]></dc:creator><pubDate>Sat, 19 Jul 2025 17:33:32 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-free-online-access-gt-httpsdevrealworldocamlorgindexhtmlhttpsdevrealworldocamlorgindexhtml">Free online access —&gt; <a target="_blank" href="https://dev.realworldocaml.org/index.html">https://dev.realworldocaml.org/index.html</a></h3>
<p>I love how the book starts off with “programming languages matter”; I agree with this, 100%, as a pdeveloper of cybersecurity products.</p>
<p>I need to find some up-to-date coding practices/resources as I go along; I’m trying everything from the book, but welcome any recommendations at all.</p>
<h3 id="heading-setting-up-opam-first-ocaml-example-and-everything-in-between">Setting up opam, first OCaml example, and everything in between</h3>
<p>Doing everything in <strong>Ubuntu</strong>.</p>
<p>First things first - you need a C compiler; I went with GCC.</p>
<pre><code class="lang-bash">sudo apt install make
sudo apt install gcc
</code></pre>
<p>Install opam (OCaml package manager, for Ubuntu) and initialise.</p>
<pre><code class="lang-bash">sudo apt install opam
opam init
</code></pre>
<p>The install OCaml (I went with 4.14.2) and update the current shell environment,</p>
<pre><code class="lang-bash">opam switch create 4.14.2
<span class="hljs-built_in">eval</span> $(opam env)
</code></pre>
<p>with some libraries and tools.</p>
<pre><code class="lang-bash">opam install core core_bench utop
</code></pre>
<p>Not sure why or how it will help at this moment, but followed instructions to create this <em>~/.ocamlinit</em> file in home directory for now.</p>
<pre><code class="lang-ocaml">#require <span class="hljs-string">"core.top"</span>;;
#require <span class="hljs-string">"ppx_jane"</span>;;
<span class="hljs-keyword">open</span> <span class="hljs-type">Base</span>;;
</code></pre>
<p>I used <strong><em>VS Code</em></strong> as my editor as I’m more familiar with it. If you choose the same, you’d have to set up the OCaml Platform plug-ins (search for it in VS Code “Extension”. You should see a white-camel-on-black-background icon) and an OCaml Language-Server-Protocol (LSP) server (as below).</p>
<pre><code class="lang-bash">opam install ocaml-lsp-server
</code></pre>
<p>Once done, just start UTop toplevel and try the “OCaml as a Calculator” example (<strong>remember the double semicolon (;) at the end of each line!</strong>). At this point, I think the <em>~/.ocamlinit</em> file helped to open Base in my UTop.</p>
<pre><code class="lang-bash">utop
</code></pre>
<pre><code class="lang-ocaml"><span class="hljs-number">3</span> + <span class="hljs-number">4</span>;;
<span class="hljs-number">8</span> / <span class="hljs-number">3</span>;;
</code></pre>
]]></content:encoded></item></channel></rss>