<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Elixir on SCMB XYZ</title>
    <link>https://www.scmb.xyz/tags/elixir/</link>
    <description>Recent content in Elixir on SCMB XYZ</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <copyright>&amp;copy; Seamus Bradley 2021–6</copyright>
    <lastBuildDate>Mon, 08 Apr 2024 16:08:16 +0100</lastBuildDate>
    <atom:link href="https://www.scmb.xyz/tags/elixir/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>One efficient solution to Circular Buffer (and two others): Week 8 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-8-exercism/</link>
      <pubDate>Mon, 08 Apr 2024 16:08:16 +0100</pubDate>
      <guid>https://www.scmb.xyz/post/week-8-exercism/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s been a while, but we&amp;rsquo;re back for week 8.&#xA;This week&amp;rsquo;s challenge is to write a &lt;a href=&#34;https://exercism.org/exercises/circular-buffer&#34;&gt;Circular Buffer&lt;/a&gt;.&#xA;It&amp;rsquo;s basically a first in, first out data structure with the limitation that there&amp;rsquo;s only $n$ slots for data.&lt;/p&gt;&#xA;&lt;p&gt;It took me a while to get around to this because of having to do a bunch more elixir learning track exercises,&#xA;and also because I&amp;rsquo;ve been on holiday.&#xA;The selection of languages available for this exercise were kind of limited,&#xA;so I&amp;rsquo;ve had to branch out into using web assembly for this one.&#xA;I also did a few easier web assembly exercises to get the hang of it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Three Genuinely Different Solutions: Week 7 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-7-exercism/</link>
      <pubDate>Mon, 11 Mar 2024 08:41:44 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-7-exercism/</guid>
      <description>&lt;p&gt;Week 7 sees us take on the challenge of &lt;a href=&#34;https://exercism.org/exercises/acronym&#34;&gt;turning a string into an acronym&lt;/a&gt;.&#xA;If we&amp;rsquo;re being picky, these are mostly initialisms rather than acronyms because they don&amp;rsquo;t spell a word.&#xA;And in a break with tradition, I actually took three fairly different approaches to solving this problem in the&#xA;three languages I tried.&lt;/p&gt;&#xA;&lt;p&gt;In fact, I also tried doing this exercise in PowerShell (because I had ambitions to go for the gold medal of doing Haskell, PowerShell and TCL).&#xA;I gave up because learning bash and elixir pretty much from scratch for this project is already a lot, so trying to wrap my head around PowerShell as well&#xA;very quickly became more effort than I was willing to put in.&#xA;I like the idea of PowerShell (what if a shell, but with objects) but in practice I find it kind of annoying.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Bashing my head against a wall: Week 6 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-6-exercism/</link>
      <pubDate>Fri, 08 Mar 2024 08:31:14 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-6-exercism/</guid>
      <description>&lt;p&gt;This week&amp;rsquo;s&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; challenge was &lt;a href=&#34;https://exercism.org/exercises/list-ops&#34;&gt;List Ops&lt;/a&gt;:&#xA;create methods for manipulating lists like &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt; and &lt;code&gt;reduce&lt;/code&gt; (well, &lt;code&gt;foldr&lt;/code&gt; and &lt;code&gt;foldl&lt;/code&gt;).&#xA;I found this exercise frustrating in different languages in different ways.&#xA;I used bash, elixir and haskell.&#xA;In elixir and haskell, the frustration was that the exercise required me to return the standard list objects.&#xA;I think it would have been more fun and more interesting to actually create a new list type and implement the methods there.&#xA;For example, do these list operations look significantly different if you have a dynamic array compared to if you have a linked list?&#xA;(For example, reversing a doubly linked list is just swapping the next and previous pointers, whereas reversing an array is going to be quite different).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Haskellbrain Harder: Week 5 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-5-exercism/</link>
      <pubDate>Fri, 23 Feb 2024 13:58:05 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-5-exercism/</guid>
      <description>&lt;p&gt;Week 5 of 48 in 24!&#xA;This time around we&amp;rsquo;re doing &lt;a href=&#34;https://exercism.org/exercises/protein-translation&#34;&gt;Protein Translation&lt;/a&gt;.&#xA;Basically, take a sequence of amino acids and translate that into a list of proteins.&#xA;Each triple of amino acids &amp;ndash; a codon &amp;ndash; gets mapped to a protein.&#xA;Or rather, some codons are valid proteins, some represent a &amp;ldquo;stop&amp;rdquo; signal,&#xA;and others are garbage and should throw an error.&lt;/p&gt;&#xA;&lt;h1 id=&#34;bash&#34;&gt;Bash&lt;/h1&gt;&#xA;&lt;p&gt;The first language I thought I&amp;rsquo;d try this week is bash.&#xA;I use bash shell most days, but I very rarely do anything beyond simple commands.&#xA;(Maybe a little &lt;code&gt;grep&lt;/code&gt;, some modest piping&amp;hellip;)&#xA;It would, however, be kind of useful to know a little more about how to write simple scripts.&#xA;Often if I need to do something like that, I&amp;rsquo;d reach for python which I know better than I do bash,&#xA;but sometimes that seems like overkill.&#xA;And I did run into a situation at work recently where a little bash script was useful.&#xA;The container I was troubleshooting didn&amp;rsquo;t have python installed, indeed,&#xA;it didn&amp;rsquo;t have &lt;code&gt;lsof&lt;/code&gt; installed, but I needed a way to get an overview of what was eating all the file descriptors.&#xA;I cobbled together something where I looped over &lt;code&gt;ls /proc/[0-9]*&lt;/code&gt; and pulled out all the &lt;code&gt;cmdline&lt;/code&gt;s.&#xA;It sort of worked but it was painful and it made me realise a better handle on bash (and unix tools more generally)&#xA;would be a good investment.&#xA;So here is my prosaic, straightforward solution to the exercise in bash.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Javascript crimes: Week 4 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-4-exercism/</link>
      <pubDate>Thu, 15 Feb 2024 09:53:54 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-4-exercism/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m now well over a week behind with these challenges, so it&amp;rsquo;s Thursday of week 5,&#xA;but we&amp;rsquo;re just finishing up week 4.&#xA;Part of the issue is I&amp;rsquo;m quite bust, but part of the issue is that I am trying to use&#xA;this as an opportunity to learn elixir, and I&amp;rsquo;m doing the elixir learning track.&#xA;This means that the exercises are locked until I do the relevant learning exercises&#xA;that teach the concepts.&#xA;Elixir has quite an extensive learning track, and this exercise is quite far down&#xA;the tree,&#xA;so I actually had to do quite a few learning exercises to unlock it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Starting off easy: Week 1 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-1-exercism/</link>
      <pubDate>Tue, 23 Jan 2024 21:19:25 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-1-exercism/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.exercism.org&#34;&gt;Exercism&lt;/a&gt; &amp;ndash; one of my favourite &amp;ldquo;learn to code&amp;rdquo; websites &amp;ndash;&#xA;is doing a thing where each week (ish?) there is a new challenge to solve a coding exercise in several languages.&#xA;It&amp;rsquo;s called &amp;ldquo;&lt;a href=&#34;https://exercism.org/challenges/48in24&#34;&gt;48 in 24&lt;/a&gt;&amp;rdquo;.&#xA;It looks like you get a bronze medal if you solve the coding exercise in some language,&#xA;a silver medal if you solve it in three specific languages,&#xA;and a gold medal if you solve it in any three languages in 2024.&#xA;We&amp;rsquo;ll see how long this lasts, but I&amp;rsquo;m going to try to blog about my attempts to solve the exercise.&#xA;To be clear, these are my attempts to solve the exercise, likely often in languages I&amp;rsquo;m not that familiar&#xA;with, so the solutions might not be optimal or idiomatic.&#xA;I&amp;rsquo;m also not going to explain every key word and language construct I use,&#xA;I&amp;rsquo;ll only explain those things that I think you might not be able to guess by looking at the code.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
