<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CIAvash - Blog</title><link>https://siavash.askari-nasr.com/blog/</link><description>Recent content in Blog</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>CIAvash</managingEditor><webMaster>CIAvash</webMaster><lastBuildDate>Mon, 10 Apr 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://siavash.askari-nasr.com/blog/atom.xml" rel="self" type="application/rss+xml"/><item><title>Nature</title><link>https://siavash.askari-nasr.com/blog/2023/04/10/nature/</link><pubDate>Mon, 10 Apr 2023 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2023/04/10/nature/</guid><description>&lt;p>You might think you have dodged a bullet&lt;br>
But you weren't the one getting shot barbarically&lt;/p>
&lt;p>Statically, you've not moved an inch since you were born&lt;br>
Thinking others are doing the same, harmonically&lt;/p>
&lt;p>You can't see beyond the tip of your nose which can only go so far&lt;br>
But the others were moving ahead; evolving naturally&lt;/p>
&lt;p>Thinking not to worry, everything is under control&lt;br>
But things were getting out of your grasp, gradually&lt;/p>
&lt;p>Your voice shouts lack of confidence&lt;br>
Although, followers will listen fanatically&lt;/p>
&lt;p>Every time you take a break to catch your breath&lt;br>
Soon you realize it's only provisionally&lt;/p>
&lt;p>You have one tool in your toolbox and it's a hammer&lt;br>
So you treat everything like a nail, anachronistically&lt;/p>
&lt;p>We've entered a new era but you're unaware&lt;br>
So keep doing the same old tricks, habitually&lt;/p>
&lt;p>I foresee that big changes are on their way&lt;br>
Not just domestically, but also internationally&lt;/p>
&lt;p>But you keep telling yourself all is well&lt;br>
Not seeing that time is going by, exponentially&lt;/p>
&lt;p>By the time you realize you're out of time&lt;br>
Nature will have taken care of you, eventually&lt;/p></description></item><item><title>flymake-rakudo - Another syntax checker for Raku on Emacs</title><link>https://siavash.askari-nasr.com/blog/2022/04/25/flymake-rakudo-another-syntax-checker-for-raku-on-emacs/</link><pubDate>Mon, 25 Apr 2022 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2022/04/25/flymake-rakudo-another-syntax-checker-for-raku-on-emacs/</guid><description>&lt;h1 id="flymake" class="heading">
&lt;a href="#flymake">
Flymake
&lt;/a>
&lt;/h1>&lt;p>I've been switching to &lt;a href="https://www.gnu.org/software/emacs/">Emacs&lt;/a> packages which are lighter and use the internal Emacs system,
instead of creating their own. This time I wanted to try
&lt;a href="https://www.gnu.org/software/emacs/manual/html_node/flymake/index.html">Flymake&lt;/a>, the syntax checker that comes with Emacs. At
first it wasn't very appealing because I thought it would only show the error on mouse hover! So I tried to see what options I
have for displaying the error messages when text cursor moves over them.&lt;/p>
&lt;h1 id="eldoc" class="heading">
&lt;a href="#eldoc">
Eldoc
&lt;/a>
&lt;/h1>&lt;p>The first step was using and tweaking &lt;a href="http://elpa.gnu.org/packages/eldoc.html">Eldoc&lt;/a>. Flymake shows errors by adding
&lt;code>flymake-eldoc-function&lt;/code> to &lt;code>eldoc-documentation-functions&lt;/code> list. But by default Eldoc only shows one message at a time and the
priority is with the order of the documentation functions.&lt;/p>
&lt;p>Fortunately there is a customization option for showing messages. The name of this option is &lt;code>eldoc-documentation-strategy&lt;/code>, you
can see its values and change it using &lt;code>customize-group&lt;/code> or &lt;code>customize-option&lt;/code> commands. The value I was interested in was
&lt;code>eldoc-documentation-compose&lt;/code>; this function waits for all strings and then shows them. But changing this option is not enough if
there are more than one messages, you have to change the &lt;code>eldoc-echo-area-use-multiline-p&lt;/code> option as well; I set it to &lt;code>always&lt;/code>.&lt;/p>
&lt;h2 id="eglot" class="heading">
&lt;a href="#eglot">
Eglot
&lt;/a>
&lt;/h2>&lt;p>A word of caution! If you use &lt;a href="https://github.com/joaotavora/eglot">Eglot&lt;/a>(An LSP client), then make sure to add
&lt;code>eldoc-documentation-strategy&lt;/code> to its &lt;code>eglot-stay-out-of&lt;/code> list. 'Cause Eglot sets it to &lt;code>eldoc-documentation-enthusiast&lt;/code> which
caused a lot of head scratching.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#dcaeea">add-to-list&lt;/span> &lt;span style="color:#56b6c2">&amp;#39;eglot-stay-out-of&lt;/span> &lt;span style="color:#56b6c2">&amp;#39;eldoc-documentation-strategy&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="eldoc-box" class="heading">
&lt;a href="#eldoc-box">
Eldoc-box
&lt;/a>
&lt;/h2>&lt;p>Now Eldoc can show all messages, documentation and Flymake diagnostics. But it shows them in the echo area. So I looked for a
package to show it as a child frame. The package I found was &lt;a href="https://github.com/casouri/eldoc-box">eldoc-box&lt;/a>.&lt;/p>
&lt;h1 id="flymake-rakudo" class="heading">
&lt;a href="#flymake-rakudo">
Flymake-rakudo
&lt;/a>
&lt;/h1>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/flymake-rakudo-screenshot.png">
&lt;img
src="https://siavash.askari-nasr.com/img/flymake-rakudo-screenshot.png"
alt="flymake-rakudo screenshot"
/>
&lt;/a>&lt;/p>
&lt;p>Now that I could see Flymake as a viable option, I had to create a syntax checker for &lt;a href="https://www.raku-lang.ir/en/">Raku&lt;/a> using
the &lt;a href="https://rakudo.org/">Rakudo&lt;/a> implementation, because that is the language I use most. Of course there is a
&lt;a href="https://github.com/purcell/flymake-flycheck">flymake-flycheck&lt;/a> package for using Flycheck checkers as Flymake backends and I
could use it with &lt;a href="https://github.com/Raku/flycheck-raku">flycheck-raku&lt;/a>, but I decided to create one for Flymake. With a great
timing, recently a package was released for Emacs which makes it easier to create Flymake checkers.&lt;/p>
&lt;h2 id="flymake-collection" class="heading">
&lt;a href="#flymake-collection">
Flymake-collection
&lt;/a>
&lt;/h2>&lt;p>That package is &lt;a href="https://github.com/mohkale/flymake-collection">flymake-collection&lt;/a>, it provides a collection of Flymake checkers
and helpers for creating checkers. At first I tried to use the regex from &lt;code>flycheck-raku&lt;/code>, but then I saw that
&lt;code>flymake-collection&lt;/code> had &lt;code>flymake-collection-define-enumerate&lt;/code> and &lt;code>flymake-collection-parse-json&lt;/code> functions for creating a
checker using JSON output. So I decided to set the &lt;code>RAKU_EXCEPTIONS_HANDLER&lt;/code> environment variable to &lt;code>JSON&lt;/code> and parse the output
of that.&lt;/p>
&lt;p>It wasn't an easy job at all, because I don't really know Emacs Lisp! And to create a flexible diagnostics generator, I had to
work with Elisp's data structures. So I had no idea what I was doing! After playing with it for a while, reading the documentation
and a lot of struggling, I learned a bit about association lists and managed to use them.&lt;/p>
&lt;p>I also had to do a bit more because of how Rakudo outputs the errors; e.g. Parsing a JSON field separately, finding the error column
from its position. But I finally did it and I'm happy with it so far. Of course it needs to be used more to find bugs or other
special cases.&lt;/p>
&lt;p>So there you have it: &lt;a href="https://github.com/Raku/flymake-rakudo">flymake-rakudo&lt;/a>.&lt;/p>
&lt;h1 id="final-words" class="heading">
&lt;a href="#final-words">
Final words
&lt;/a>
&lt;/h1>&lt;p>Even with all that, I hope we'll see a language server implementation for Raku.&lt;/p></description></item><item><title>How to write Raku's trans routine/operator in Go</title><link>https://siavash.askari-nasr.com/blog/2022/02/13/how-to-write-raku-trans-sub-operator-in-go/</link><pubDate>Sun, 13 Feb 2022 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2022/02/13/how-to-write-raku-trans-sub-operator-in-go/</guid><description>&lt;p>I was looking for a way to transliterate(translate) English numbers to Persian numbers in Go.
Such functionality is usually found in programming languages, but I wasn't expecting too much from Go.&lt;/p>
&lt;p>It's very easy to do in &lt;a href="https://www.raku-lang.ir/en">Raku&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-raku" data-lang="raku">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#d19a66">567&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">trans&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span> &amp;#39;&lt;span style="color:#98c379">0&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">..&lt;/span>&amp;#39;&lt;span style="color:#98c379">9&lt;/span>&amp;#39; &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &amp;#39;&lt;span style="color:#98c379">۰&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">..&lt;/span>&amp;#39;&lt;span style="color:#98c379">۹&lt;/span>&amp;#39;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">=output&lt;/span>&lt;span style="color:#7e97c3"> ۵۶۷␤
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">TR&lt;/span>/&lt;span style="color:#d19a66">0&lt;/span>&lt;span style="color:#c7bf54">..&lt;/span>&lt;span style="color:#d19a66">9&lt;/span>/&lt;span style="color:#63c381">۰..۹&lt;/span>/ &lt;span style="color:#c678dd">given&lt;/span> &lt;span style="color:#d19a66">567&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">=output&lt;/span>&lt;span style="color:#7e97c3"> ۵۶۷␤
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For Go I found &lt;a href="https://pkg.go.dev/github.com/huandu/xstrings">xstrings&lt;/a> module which has a
&lt;a href="https://pkg.go.dev/github.com/huandu/xstrings#Translate">&lt;code>Translate&lt;/code>&lt;/a> function. But the solution I came up with was using
&lt;a href="https://pkg.go.dev/strings#Replacer">&lt;code>NewReplacer&lt;/code>&lt;/a> function from Go's internal &lt;a href="https://pkg.go.dev/strings">strings&lt;/a>
module:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">package&lt;/span> &lt;span style="color:#c1abea">main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">import&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#98c379">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#98c379">&amp;#34;strings&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">func&lt;/span> &lt;span style="color:#00b1f7">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">fmt&lt;/span>.&lt;span style="color:#00b1f7">Println&lt;/span>(&lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">NewReplacer&lt;/span>(&lt;span style="color:#98c379">`0`&lt;/span>, &lt;span style="color:#98c379">`۰`&lt;/span>, &lt;span style="color:#98c379">`1`&lt;/span>, &lt;span style="color:#98c379">`۱`&lt;/span>, &lt;span style="color:#98c379">`2`&lt;/span>, &lt;span style="color:#98c379">`۲`&lt;/span>, &lt;span style="color:#98c379">`3`&lt;/span>, &lt;span style="color:#98c379">`۳`&lt;/span>, &lt;span style="color:#98c379">`4`&lt;/span>, &lt;span style="color:#98c379">`۴`&lt;/span>, &lt;span style="color:#98c379">`5`&lt;/span>, &lt;span style="color:#98c379">`۵`&lt;/span>, &lt;span style="color:#98c379">`6`&lt;/span>, &lt;span style="color:#98c379">`۶`&lt;/span>, &lt;span style="color:#98c379">`7`&lt;/span>, &lt;span style="color:#98c379">`۷`&lt;/span>, &lt;span style="color:#98c379">`8`&lt;/span>, &lt;span style="color:#98c379">`۸`&lt;/span>, &lt;span style="color:#98c379">`9`&lt;/span>, &lt;span style="color:#98c379">`۹`&lt;/span>).&lt;span style="color:#00b1f7">Replace&lt;/span>(&lt;span style="color:#98c379">`567`&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;a href="https://go.dev/play/p/-o0OUvoLKsm">Go playground link&lt;/a>&lt;/p>
&lt;p>This could be easier to write if Go had a &lt;code>zip&lt;/code> function, so you could zip two slices (or ranges if Go had a range
operator) and then use the &lt;code>...&lt;/code> unpack operator. Or &lt;code>Replacer&lt;/code> could have a method that took two slices or better two
ranges(that is, if Go had it), specially now that Generics are coming to Go.&lt;/p>
&lt;p>Unrelated to the title of this blog post, I was also looking for a module to parse HTML documents using CSS selectors;
my search led me to &lt;a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery">goquery&lt;/a>. Which was what I wanted, but I
couldn't find an easy way to get the whitespace-trimmed text content of HTML elements; there was a &lt;code>Text&lt;/code> function, but
that contained everything. It seems it's not just the way of thinking of the Go language that makes me want more, but
also some Go modules. So I ended up writing a recursive function to trim whitespace using &lt;code>strings.TrimSpace&lt;/code> and join texts.&lt;/p>
&lt;p>This is how I would do it in Raku, using &lt;a href="https://github.com/zostay/raku-DOM-Tiny">DOM::Tiny&lt;/a> (also containing the previous code):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-raku" data-lang="raku">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">put&lt;/span> &lt;span style="color:#dcaeea">$dom&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">find&lt;/span>(&amp;#39;&lt;span style="color:#98c379">.my-element &amp;gt; div&lt;/span>&amp;#39;)&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">map&lt;/span>(&lt;span style="color:#c7bf54">*.&lt;/span>&lt;span style="color:#00b1f7">all-text&lt;/span>(:&lt;span style="color:#98c379">trim&lt;/span>))&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">join&lt;/span>(&amp;#34;&lt;span style="color:#d26464;font-weight:bold">\n&lt;/span>&amp;#34;)&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">trans&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span> &amp;#39;&lt;span style="color:#98c379">0&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">..&lt;/span>&amp;#39;&lt;span style="color:#98c379">9&lt;/span>&amp;#39; &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &amp;#39;&lt;span style="color:#98c379">۰&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">..&lt;/span>&amp;#39;&lt;span style="color:#98c379">۹&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And this is my Go solution(maybe there are better ways to do it, that I'm not aware of, or even better way to write my code):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">// ........&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">text&lt;/span> &lt;span style="color:#c7bf54">:=&lt;/span> &lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">Join&lt;/span>(&lt;span style="color:#c1abea">doc&lt;/span>.&lt;span style="color:#00b1f7">Find&lt;/span>(&lt;span style="color:#98c379">`.my-element &amp;gt; div`&lt;/span>).&lt;span style="color:#00b1f7">Map&lt;/span>(&lt;span style="color:#c1abea">getText&lt;/span>), &lt;span style="color:#98c379">&amp;#34;\n&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">text&lt;/span> = &lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">NewReplacer&lt;/span>(&lt;span style="color:#98c379">`0`&lt;/span>, &lt;span style="color:#98c379">`۰`&lt;/span>, &lt;span style="color:#98c379">`1`&lt;/span>, &lt;span style="color:#98c379">`۱`&lt;/span>, &lt;span style="color:#98c379">`2`&lt;/span>, &lt;span style="color:#98c379">`۲`&lt;/span>, &lt;span style="color:#98c379">`3`&lt;/span>, &lt;span style="color:#98c379">`۳`&lt;/span>, &lt;span style="color:#98c379">`4`&lt;/span>, &lt;span style="color:#98c379">`۴`&lt;/span>, &lt;span style="color:#98c379">`5`&lt;/span>, &lt;span style="color:#98c379">`۵`&lt;/span>, &lt;span style="color:#98c379">`6`&lt;/span>, &lt;span style="color:#98c379">`۶`&lt;/span>, &lt;span style="color:#98c379">`7`&lt;/span>, &lt;span style="color:#98c379">`۷`&lt;/span>, &lt;span style="color:#98c379">`8`&lt;/span>, &lt;span style="color:#98c379">`۸`&lt;/span>, &lt;span style="color:#98c379">`9`&lt;/span>, &lt;span style="color:#98c379">`۹`&lt;/span>).&lt;span style="color:#00b1f7">Replace&lt;/span>(&lt;span style="color:#c1abea">text&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">fmt&lt;/span>.&lt;span style="color:#00b1f7">Println&lt;/span>(&lt;span style="color:#c1abea">text&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">// ........&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">func&lt;/span> &lt;span style="color:#00b1f7">getText&lt;/span> (&lt;span style="color:#c1abea">_&lt;/span> &lt;span style="color:#ef8383">int&lt;/span>, &lt;span style="color:#c1abea">s&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span>&lt;span style="color:#c1abea">goquery&lt;/span>.&lt;span style="color:#c1abea">Selection&lt;/span>) &lt;span style="color:#ef8383">string&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">if&lt;/span> &lt;span style="color:#c1abea">children&lt;/span> &lt;span style="color:#c7bf54">:=&lt;/span> &lt;span style="color:#c1abea">s&lt;/span>.&lt;span style="color:#00b1f7">ChildrenFiltered&lt;/span>(&lt;span style="color:#98c379">`:not(img)`&lt;/span>); &lt;span style="color:#c1abea">children&lt;/span>.&lt;span style="color:#00b1f7">Text&lt;/span>() &lt;span style="color:#c7bf54">!=&lt;/span> &lt;span style="color:#98c379">``&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">return&lt;/span> &lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">Join&lt;/span>(&lt;span style="color:#c1abea">children&lt;/span>.&lt;span style="color:#00b1f7">Map&lt;/span>(&lt;span style="color:#c1abea">getText&lt;/span>), &lt;span style="color:#98c379">` `&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#c678dd">else&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">return&lt;/span> &lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">TrimSpace&lt;/span>(&lt;span style="color:#c1abea">s&lt;/span>.&lt;span style="color:#00b1f7">Text&lt;/span>())
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Another solution is using the &lt;code>regexp&lt;/code> module to replace all whitespace:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">// ........&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">text&lt;/span> &lt;span style="color:#c7bf54">:=&lt;/span> &lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">Join&lt;/span>(&lt;span style="color:#c1abea">doc&lt;/span>.&lt;span style="color:#00b1f7">Find&lt;/span>(&lt;span style="color:#98c379">`.my-element &amp;gt; div`&lt;/span>).&lt;span style="color:#00b1f7">Map&lt;/span>(&lt;span style="color:#c678dd">func&lt;/span>(&lt;span style="color:#c1abea">_&lt;/span> &lt;span style="color:#ef8383">int&lt;/span>, &lt;span style="color:#c1abea">s&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span>&lt;span style="color:#c1abea">goquery&lt;/span>.&lt;span style="color:#c1abea">Selection&lt;/span>) &lt;span style="color:#ef8383">string&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">re&lt;/span> &lt;span style="color:#c7bf54">:=&lt;/span> &lt;span style="color:#c1abea">regexp&lt;/span>.&lt;span style="color:#00b1f7">MustCompile&lt;/span>(&lt;span style="color:#98c379">`\s+`&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">return&lt;/span> &lt;span style="color:#c1abea">re&lt;/span>.&lt;span style="color:#00b1f7">ReplaceAllLiteralString&lt;/span>(&lt;span style="color:#c1abea">s&lt;/span>.&lt;span style="color:#00b1f7">Text&lt;/span>(), &lt;span style="color:#98c379">` `&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }), &lt;span style="color:#98c379">&amp;#34;\n&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">text&lt;/span> = &lt;span style="color:#c1abea">strings&lt;/span>.&lt;span style="color:#00b1f7">NewReplacer&lt;/span>(&lt;span style="color:#98c379">`0`&lt;/span>, &lt;span style="color:#98c379">`۰`&lt;/span>, &lt;span style="color:#98c379">`1`&lt;/span>, &lt;span style="color:#98c379">`۱`&lt;/span>, &lt;span style="color:#98c379">`2`&lt;/span>, &lt;span style="color:#98c379">`۲`&lt;/span>, &lt;span style="color:#98c379">`3`&lt;/span>, &lt;span style="color:#98c379">`۳`&lt;/span>, &lt;span style="color:#98c379">`4`&lt;/span>, &lt;span style="color:#98c379">`۴`&lt;/span>, &lt;span style="color:#98c379">`5`&lt;/span>, &lt;span style="color:#98c379">`۵`&lt;/span>, &lt;span style="color:#98c379">`6`&lt;/span>, &lt;span style="color:#98c379">`۶`&lt;/span>, &lt;span style="color:#98c379">`7`&lt;/span>, &lt;span style="color:#98c379">`۷`&lt;/span>, &lt;span style="color:#98c379">`8`&lt;/span>, &lt;span style="color:#98c379">`۸`&lt;/span>, &lt;span style="color:#98c379">`9`&lt;/span>, &lt;span style="color:#98c379">`۹`&lt;/span>).&lt;span style="color:#00b1f7">Replace&lt;/span>(&lt;span style="color:#c1abea">text&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">fmt&lt;/span>.&lt;span style="color:#00b1f7">Println&lt;/span>(&lt;span style="color:#c1abea">text&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">// ........&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>What I get from Go is speed, so I won't complain too much 😀&lt;/p>
&lt;p>And just for fun, I'm still seeing this when I visit &lt;a href="https://pkg.go.dev">https://pkg.go.dev&lt;/a> :
&lt;a href="https://siavash.askari-nasr.com/img/pkg.go.dev-blocked-for-Iran-by-Google.png">
&lt;img
src="https://siavash.askari-nasr.com/img/pkg.go.dev-blocked-for-Iran-by-Google.png"
alt="pkg.go.dev blocked for Iran by Google"
/>
&lt;/a>&lt;/p></description></item><item><title>T - Easy way of writing test assertions which output good test descriptions and error messages in Raku</title><link>https://siavash.askari-nasr.com/blog/2022/02/13/T-easy-way-writing-test-assertions-good-test-descriptions-error-messages-in-raku/</link><pubDate>Sun, 13 Feb 2022 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2022/02/13/T-easy-way-writing-test-assertions-good-test-descriptions-error-messages-in-raku/</guid><description>&lt;p>After I finished watching &lt;a href="https://www.codesections.com/">Daniel Sockwell&lt;/a>'s &lt;a href="https://fosdem.org/2022/schedule/event/simpletesting/">FOSDEM 2022 Raku
presentation&lt;/a>, I thought this is a good opportunity to play with
&lt;a href="https://www.raku-lang.ir/en">Raku&lt;/a>'s &lt;a href="https://design.raku.org/S99.html#slang">slangs&lt;/a>, something I hadn't done before.&lt;/p>
&lt;p>What is Daniel's talk(and upcoming module) and my module going to solve?&lt;/p>
&lt;ul>
&lt;li>Write less but more readable test code&lt;/li>
&lt;li>Get a useful test description and failure message&lt;/li>
&lt;/ul>
&lt;p>If you use &lt;a href="https://docs.raku.org/type/Test#sub_cmp-ok">&lt;code>cmp-ok&lt;/code>&lt;/a>, you get a good error message; but without a test
description it's sometimes hard to understand. Also &lt;code>cmp-ok&lt;/code> and other test functions(most of them, &lt;code>use-ok&lt;/code> being an
exception for example) do not output anything on a successful test, unless you provide the description yourself. I
personally think that test sub routines should generate a description if one is not provided. But of course that
cannot be done with simple functions. Maybe the &lt;a href="https://docs.raku.org/type/Test">Test&lt;/a> module needs to be rethought in the future?&lt;/p>
&lt;p>So I made the &lt;a href="https://github.com/CIAvash/T">T&lt;/a> slang which provides the &lt;code>t&lt;/code> keyword for writing test assertions. I didn't
want to make it complicated, so it's a very short and simple slang which takes an expression of form &lt;code>&amp;lt;got&amp;gt; &amp;lt;infix&amp;gt; &amp;lt;expected&amp;gt;&lt;/code>.&lt;/p>
&lt;p>The current status of the module: It works for me!&lt;/p>
&lt;p>Here are some examples:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-raku" data-lang="raku">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">use&lt;/span> &lt;span style="color:#ef8383">T&lt;/span>:&lt;span style="color:#98c379">auth&lt;/span>&amp;lt;&lt;span style="color:#98c379">zef:CIAash&lt;/span>&amp;gt;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">t&lt;/span> &lt;span style="color:#d19a66">4&lt;/span> &lt;span style="color:#c7bf54">==&lt;/span> &lt;span style="color:#d19a66">4&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">=output&lt;/span>&lt;span style="color:#7e97c3"> ok 1 - 4 == 4
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span>&lt;span style="color:#ef8383">t&lt;/span> &lt;span style="color:#dcaeea">$my_great_module&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">return&lt;/span>(&amp;#39;&lt;span style="color:#98c379">something&lt;/span>&amp;#39;) &lt;span style="color:#b756ff;font-weight:bold">eq&lt;/span> &amp;#39;&lt;span style="color:#98c379">something&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">=output&lt;/span>&lt;span style="color:#7e97c3"> ok 2 - $my_great_module.return(&amp;#39;something&amp;#39;) eq &amp;#39;something&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span>&lt;span style="color:#ef8383">t&lt;/span> &lt;span style="color:#dcaeea">$my_great_module&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">return&lt;/span>(&amp;#39;&lt;span style="color:#98c379">something else&lt;/span>&amp;#39;) &lt;span style="color:#b756ff;font-weight:bold">eq&lt;/span> &amp;#39;&lt;span style="color:#98c379">something&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">=output&lt;/span>&lt;span style="color:#7e97c3"> not ok 3 - $my_great_module.return(&amp;#39;something else&amp;#39;) eq &amp;#39;something&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3"># Failed test &amp;#39;$my_great_module.return(&amp;#39;something else&amp;#39;) eq &amp;#39;something&amp;#39;&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3"># at ... line ...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3"># expected: &amp;#34;something&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3"># matcher: &amp;#39;infix:&amp;lt;eq&amp;gt;&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3"># got: &amp;#34;something else&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Raku, Go, Chroma, Germanium, Hugo and my blog</title><link>https://siavash.askari-nasr.com/blog/2021/07/05/raku-go-chroma-germanium-hugo-and-my-blog/</link><pubDate>Mon, 05 Jul 2021 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2021/07/05/raku-go-chroma-germanium-hugo-and-my-blog/</guid><description>&lt;p>When I created my &lt;a href="https://www.raku-lang.ir/en">Raku programming language website&lt;/a> with
&lt;a href="https://gohugo.io/">Hugo&lt;/a> static site generator, I had to manually create the syntax highlighted
html files for code examples shown in the front page, because Hugo used
&lt;a href="https://github.com/alecthomas/chroma/">Chroma&lt;/a>(written in &lt;a href="https://golang.org/">Go&lt;/a> and uses a
mostly similar API to &lt;a href="https://pygments.org/">Pygments&lt;/a>) for syntax highlighting which didn't
support Raku. So I opened an issue on Chroma, the discussion showed that you cannot just convert
the Raku lexer from Pygments to Chroma; You would need to create some functions manually, and
Chroma needed a new &lt;code>Emitter&lt;/code> interface which would take the &lt;code>LexerState&lt;/code> as an argument, because
Raku has some complex syntax; the Raku lexer in Pygments had functions for finding closing
brackets matching the opening brackets, and for regex nesting in &lt;code>tokens&lt;/code>, &lt;code>regexes&lt;/code> and
&lt;code>rules&lt;/code>. In the end I realized functions for token nesting were unnecessary.&lt;/p>
&lt;p>But I was curious if I could do something with the broken lexer I generated with the
&lt;code>pygments2chroma.py&lt;/code> script that comes with Chroma. So I began working on the Raku lexer
without knowing Go, Chroma, Python or Pygments.&lt;/p>
&lt;h2 id="chroma" class="heading">
&lt;a href="#chroma">
Chroma
&lt;/a>
&lt;/h2>&lt;p>After playing with the lexer for a while, I was very close to giving up. But after looking at
the Chroma code and the functions it provided and also looking at some other lexers, I began to
come up with some ideas.&lt;/p>
&lt;p>For finding closing brackets I used the function generated by &lt;code>pygments2chroma&lt;/code> and modified it a
lot and also as a workaround I placed empty capture groups inside the patterns that needed
bracket finding; and I filled those placeholders with the &lt;code>bracketsFinder&lt;/code> function(or
&lt;code>mutator&lt;/code>).&lt;/p>
&lt;p>I also used a placeholder rule inside regex which would be replaced by &lt;code>bracketsFinder&lt;/code> with the
appropriate rule which &lt;code>Pop&lt;/code>ed from the regex state when the delimiter matched.&lt;/p>
&lt;p>I did the same thing with &lt;code>POD&lt;/code> formatters(&lt;code>C&amp;lt;code&amp;gt;, B&amp;lt;bold&amp;gt;,...&lt;/code>), although I didn't have to,
and could create a state for each formatter that needed different tokens for highlighting.&lt;/p>
&lt;p>I also created &lt;code>Emitters&lt;/code> for Raku's colon pair syntax and &lt;code>POD&lt;/code> config.&lt;/p>
&lt;p>So I finally managed to create an imperfect &lt;a href="https://github.com/alecthomas/chroma/blob/master/lexers/r/raku.go">Raku
lexer&lt;/a> for Chroma.&lt;/p>
&lt;p>I added some things to Chroma itself as well; Added support for named
capture groups(although there is something people need to watch
for. &lt;code>regexp2&lt;/code>, the regex package Chroma uses, implements .Nets' regex
engine which doesn't maintain the order of captures, in other words,
the number capturing groups come first then named capturing groups are
appended, which I found surprising, and made a &lt;a href="https://github.com/dlclark/regexp2/pull/43">pull
request&lt;/a> to add an option
for maintaining the capture order (I don't know if it'll get merged),
added the &lt;code>ByGroupNames&lt;/code> helper function, and made the &lt;code>emitter&lt;/code>
functions take &lt;code>*LexerState&lt;/code> as argument, so they have access to more
things.&lt;/p>
&lt;p>I should have done these things before I made the Raku lexer,
so I could use them while I was making it, but at the time, I didn't
know I could do it! And also improved the Svelte, SCSS and Fish
lexers. Additionally, added two new styles,
&lt;a href="https://github.com/alecthomas/chroma/blob/master/styles/doom-one.go">doom-one&lt;/a>
and
&lt;a href="https://github.com/alecthomas/chroma/blob/master/styles/doom-one2.go">doom-one2&lt;/a>
which are inspired by Atom One and Doom Emacs's Doom One themes. You
can use them in version 0.9.2.&lt;/p>
&lt;p>Lastly, the things I learned Chroma command line tool can do(which of course you can find by
running &lt;code>chroma --help&lt;/code>):&lt;/p>
&lt;p>Printing syntax highlighted files to terminal:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fish" data-lang="fish">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">chroma&lt;/span>  &lt;span style="color:#b3d23c">-f&lt;/span> terminal256 &lt;span style="color:#b3d23c">-s&lt;/span> doom-one source.raku
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Generating SVG file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fish" data-lang="fish">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">chroma&lt;/span> &lt;span style="color:#b3d23c">-s&lt;/span> doom-one source.raku &lt;span style="color:#b3d23c">--svg&lt;/span> &lt;span style="color:#c7bf54">&amp;gt;&lt;/span> output.svg
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Generating styled HTML files:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fish" data-lang="fish">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">chroma&lt;/span> &lt;span style="color:#b3d23c">-s&lt;/span> doom-one &lt;span style="color:#b3d23c">--html&lt;/span> &lt;span style="color:#b3d23c">--html-all-styles&lt;/span> &lt;span style="color:#b3d23c">--html-lines&lt;/span> source.raku &lt;span style="color:#c7bf54">&amp;gt;&lt;/span> output.html
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can install Chroma with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fish" data-lang="fish">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">go&lt;/span> install github.com/alecthomas/chroma@latest
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Or if you use Arch Linux, you can install it from &lt;a href="https://aur.archlinux.org/packages/chroma-bin/">AUR&lt;/a>.&lt;/p>
&lt;h2 id="generate-images-from-source-code-with-germanium" class="heading">
&lt;a href="#generate-images-from-source-code-with-germanium">
Generate images from source code with Germanium
&lt;/a>
&lt;/h2>&lt;p>&lt;a href="https://github.com/matsuyoshi30/germanium">Germanium&lt;/a>(written in Go) is an alternative to
&lt;a href="https://github.com/Aloxaf/silicon">Silicon&lt;/a>, which is written in
&lt;a href="https://www.rust-lang.org/">Rust&lt;/a> and uses &lt;a href="https://github.com/trishume/syntect">Syntect&lt;/a> which
uses Sublime Text &lt;a href="https://github.com/sublimehq/Packages">syntax definitions&lt;/a> for syntax
highlighting, which does not support Raku. Syntax definitions are written in
&lt;a href="https://yaml.org/">YAML&lt;/a> files, I don't know if you can put logic in there. Also &lt;a href="https://github.com/sublimehq/Packages#new-packages">they
say&lt;/a> they don't accept new packages! Maybe
Syntect accepts packages in their &lt;code>submodule&lt;/code>? I don't know.&lt;/p>
&lt;p>Anyway, I added support for options choosing a style and also listing styles. Also changed the
Chroma version in the dependencies, so new lexers and styles can be used in Germanium v1.2.0.&lt;/p>
&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/germanium-raku-go.png">
&lt;img
src="https://siavash.askari-nasr.com/img/germanium-raku-go.png"
alt="Germanium: raku and go"
/>
&lt;/a>&lt;/p>
&lt;p>Generating images:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fish" data-lang="fish">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">germanium&lt;/span> &lt;span style="color:#b3d23c">-s&lt;/span> doom-one &lt;span style="color:#b3d23c">-o&lt;/span> output.png source.raku
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can install Germanium with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fish" data-lang="fish">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">go&lt;/span> install github.com/matsuyoshi30/germanium@latest
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Or if you use Arch Linux, you can install it from &lt;a href="https://aur.archlinux.org/packages/germanium-bin/">AUR&lt;/a>.&lt;/p>
&lt;h2 id="golang" class="heading">
&lt;a href="#golang">
Golang
&lt;/a>
&lt;/h2>&lt;p>While writing the lexer, I often felt frustrated, because I wanted some functionality and would
search for it and find three things:&lt;/p>
&lt;ul>
&lt;li>A GitHub issue with a proposal for what I wanted, which would be a closed issue and not
implemented&lt;/li>
&lt;li>A Stack Overflow answer which said: you can do it with &amp;quot;this long and manually written code&amp;quot;&lt;/li>
&lt;li>A Stack Overflow answer which said: you can emulate it like this&lt;/li>
&lt;/ul>
&lt;p>Which made me make &lt;a href="https://mastodon.social/@CIAvash/106144252945443677">a joke&lt;/a> about it.&lt;/p>
&lt;p>Go, to me is the complete opposite of Raku. And yet even though I didn't like it and the
frustration that came with it, strangely I began to kinda like it! I contributed to
different Go projects in a relatively short time, that says something nice about Go. So I may
actually try to learn it. Even though I see this when I visit their website(because of Google App
Engine and sanctions! Google usually goes to the extreme).&lt;/p>
&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/google-403-forbidden.jpg">
&lt;img
src="https://siavash.askari-nasr.com/img/google-403-forbidden.jpg"
alt="google-403-forbidden-iran"
/>
&lt;/a>&lt;/p>
&lt;p>Lastly, there are things the &lt;code>go&lt;/code> command line tool doesn't provide(or maybe I'm unaware of it).
Such as updating all modules installed globally(especially useful for
command line apps).&lt;/p>
&lt;h2 id="hugo-and-my-blog" class="heading">
&lt;a href="#hugo-and-my-blog">
Hugo and my blog
&lt;/a>
&lt;/h2>&lt;p>My blog was generated by &lt;a href="https://jekyllrb.com/">Jekyll&lt;/a> until now. I don't blog often, so I
didn't have much motivation to migrate to Hugo, even though Hugo has more features. But I said
what the heck, I created a lexer that Hugo uses so I might as well use it. Therefore, I migrated
my blog to Hugo and even used some of its features, for example I created
&lt;a href="https://siavash.askari-nasr.com/categories">categories&lt;/a> and &lt;a href="https://siavash.askari-nasr.com/tags">tags&lt;/a>, added TOC and used the &lt;a href="https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks">markdown render
hooks&lt;/a> feature for
headings to linkify them and images to linkify them to their sources which is useful
when the image is large.&lt;/p>
&lt;p>Raku lexer is available since Hugo v0.84.0.&lt;/p>
&lt;h2 id="raku" class="heading">
&lt;a href="#raku">
Raku
&lt;/a>
&lt;/h2>&lt;p>Finally some syntax highlighting for Raku inside Hugo with random code from here and there:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-raku" data-lang="raku">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-weight:bold;font-style:italic">#!/usr/bin/env raku&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">=head1&lt;/span>&lt;span style="color:#a2cbff;font-weight:bold"> Raku syntax highlighting
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2cbff;font-weight:bold">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2cbff;font-weight:bold">&lt;/span>&lt;span style="color:#c678dd">=begin code&lt;/span> :&lt;span style="color:#b3d23c">lang&lt;/span>&amp;lt;&lt;span style="color:#98c379">go&lt;/span>&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">package&lt;/span> &lt;span style="color:#c1abea">main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">import&lt;/span> &lt;span style="color:#98c379">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">func&lt;/span> &lt;span style="color:#00b1f7">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">fmt&lt;/span>.&lt;span style="color:#00b1f7">Println&lt;/span>(&lt;span style="color:#98c379">`Hello, Raku`&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">=end code&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">put&lt;/span> &amp;#39;&lt;span style="color:#98c379">Hello, Go!&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">#`(
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">multi
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">line
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">comment
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">qq&lt;/span>｢&lt;span style="color:#63c381">some &lt;/span>&lt;span style="color:#dcaeea">$scalar&lt;/span>&lt;span style="color:#63c381"> text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">q&lt;/span>&lt;span style="color:#98c379">ww&lt;/span>｢&lt;span style="color:#63c381">some &lt;/span>&lt;span style="color:#dcaeea">$variable&lt;/span>&lt;span style="color:#63c381"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">some other text&lt;/span>&amp;#39;&lt;span style="color:#63c381"> text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">q&lt;/span>&lt;span style="color:#98c379">:ww&lt;/span>｢&lt;span style="color:#63c381">some &lt;/span>&lt;span style="color:#dcaeea">$variable&lt;/span>&lt;span style="color:#63c381"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">some other text&lt;/span>&amp;#39;&lt;span style="color:#63c381"> text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">q&lt;/span>&lt;span style="color:#98c379">:w&lt;/span>｢&lt;span style="color:#98c379">some $variable &amp;#39;some other text&amp;#39; text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">qq&lt;/span>&lt;span style="color:#98c379">:w&lt;/span>｢&lt;span style="color:#63c381">some &lt;/span>&lt;span style="color:#dcaeea">$variable&lt;/span>&lt;span style="color:#63c381"> &amp;#39;some other text&amp;#39; text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">Q&lt;/span>&lt;span style="color:#98c379">:c&lt;/span>｢&lt;span style="color:#98c379">some $variable &amp;#39;some text&amp;#39; &lt;/span>{ &lt;span style="color:#d19a66">2&lt;/span> &lt;span style="color:#c7bf54">+&lt;/span> &lt;span style="color:#d19a66">1&lt;/span> }&lt;span style="color:#98c379"> text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">q&lt;/span>&lt;span style="color:#98c379">:a&lt;/span>｢&lt;span style="color:#98c379">some &lt;/span>&lt;span style="color:#dcaeea">@array&lt;/span>&lt;span style="color:#98c379">[1] &amp;#39;some text&amp;#39; { 2 + 1 } text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">Q&lt;/span>&lt;span style="color:#98c379">:a:c&lt;/span>｢&lt;span style="color:#63c381">some &lt;/span>&lt;span style="color:#dcaeea">@array&lt;/span>&lt;span style="color:#63c381"> &amp;#39;some text&amp;#39; &lt;/span>{ &lt;span style="color:#d19a66">2&lt;/span> &lt;span style="color:#c7bf54">+&lt;/span> &lt;span style="color:#d19a66">1&lt;/span> }&lt;span style="color:#63c381"> text&lt;/span>｣;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c678dd">Q&lt;/span>[&lt;span style="color:#98c379">some &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\qq&lt;/span>[&lt;span style="color:#dcaeea">$variable&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#00b1f7">method&lt;/span>()]&lt;span style="color:#98c379"> testing&lt;/span>];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &amp;#39;&lt;span style="color:#98c379">some &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\qq&lt;/span>[&lt;span style="color:#dcaeea">$variable&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#00b1f7">method&lt;/span>()]&lt;span style="color:#98c379"> testing&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &amp;#34;&lt;span style="color:#63c381">some &lt;/span>&lt;span style="color:#dcaeea">@array&lt;/span>&lt;span style="color:#63c381">[2] &lt;/span>&lt;span style="color:#dcaeea">%hash&lt;/span>{&amp;#39;&lt;span style="color:#98c379">test&lt;/span>&amp;#39;}&lt;span style="color:#63c381"> &lt;/span>&lt;span style="color:#dcaeea">$variable&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#00b1f7">method&lt;/span>()&lt;span style="color:#63c381"> func() testing&lt;/span>&amp;#34;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">use&lt;/span> &lt;span style="color:#76a9f9">Some::Module&lt;/span>:&lt;span style="color:#b3d23c">auth&lt;/span>&amp;lt;&lt;span style="color:#98c379">author&lt;/span>&amp;gt;:&lt;span style="color:#b3d23c">ver&lt;/span>(&lt;span style="color:#c678dd">v&lt;/span>&lt;span style="color:#d19a66">1&lt;/span>&lt;span style="color:#bda26f">.*.0&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#fd7474;font-weight:bold">X::SomeException&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">#| B&lt;/span>&amp;lt;&lt;span style="font-weight:bold">Fibonacci&lt;/span>&amp;gt;&lt;span style="color:#7e97c3"> with multiple dispatch
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span>&lt;span style="color:#c678dd">multi&lt;/span> &lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#00b1f7">fib&lt;/span> (&lt;span style="color:#d19a66">0&lt;/span> &lt;span style="color:#c678dd">--&amp;gt;&lt;/span> &lt;span style="color:#d19a66">0&lt;/span>) {}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">multi&lt;/span> &lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#00b1f7">fib&lt;/span> (&lt;span style="color:#d19a66">1&lt;/span> &lt;span style="color:#c678dd">--&amp;gt;&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>) {}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">multi&lt;/span> &lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#00b1f7">fib&lt;/span> (\&lt;span style="color:#c1abea">n&lt;/span> &lt;span style="color:#c678dd">where&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span> &lt;span style="color:#c7bf54">&amp;gt;&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#00b1f7">fib&lt;/span>(&lt;span style="color:#c1abea">n&lt;/span> &lt;span style="color:#c7bf54">-&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>) &lt;span style="color:#c7bf54">+&lt;/span> &lt;span style="color:#00b1f7">fib&lt;/span>(&lt;span style="color:#c1abea">n&lt;/span> &lt;span style="color:#c7bf54">-&lt;/span> &lt;span style="color:#d19a66">2&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c1abea">fib&lt;/span> &lt;span style="color:#d19a66">10&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 55&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Indirect invocant&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00b1f7">notes&lt;/span> &lt;span style="color:#dcaeea">$trip:&lt;/span> &amp;#34;&lt;span style="color:#63c381">Almost there&lt;/span>&amp;#34;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f5a40d">LABEL&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">for&lt;/span> &amp;lt;&lt;span style="color:#98c379">a b c&lt;/span>&amp;gt; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">put&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Roles and classes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">role&lt;/span> &lt;span style="color:#76a9f9">Shape&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">method&lt;/span> &lt;span style="color:#00b1f7">area&lt;/span> { &lt;span style="color:#c7bf54">...&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">method&lt;/span> &lt;span style="color:#00b1f7">print_area&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">say&lt;/span> &amp;#34;&lt;span style="color:#63c381">Area of &lt;/span>{&lt;span style="color:#ef8383">self&lt;/span>&lt;span style="color:#c7bf54">.^&lt;/span>&lt;span style="color:#ef8383">name&lt;/span>}&lt;span style="color:#63c381"> is &lt;/span>{&lt;span style="color:#ef8383">self&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#00b1f7">area&lt;/span>}&lt;span style="color:#63c381">.&lt;/span>&amp;#34;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">class&lt;/span> &lt;span style="color:#76a9f9">Rectangle&lt;/span> &lt;span style="color:#c678dd">does&lt;/span> &lt;span style="color:#76a9f9">Shape&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">has&lt;/span> &lt;span style="color:#dcaeea">$.width&lt;/span> &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">required&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">has&lt;/span> &lt;span style="color:#dcaeea">$.height&lt;/span> &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">required&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">method&lt;/span> &lt;span style="color:#00b1f7">area&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#dcaeea">$!width&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span> &lt;span style="color:#dcaeea">$!height&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">Rectangle&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">new&lt;/span>(&lt;span style="color:#98c379">width&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#d19a66">5&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#98c379">height&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#d19a66">7&lt;/span>)&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#00b1f7">print_area&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: Area of Rectangle is 35.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">#| U&lt;/span>&amp;lt;&lt;span style="text-decoration:underline">INI&lt;/span>&amp;gt;&lt;span style="color:#7e97c3"> Parser
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span>&lt;span style="color:#c678dd">grammar&lt;/span> &lt;span style="color:#76a9f9">INIParser&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">TOP&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">block&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">section&lt;/span>&amp;gt;&lt;span style="color:#c7bf54">*&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">section&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">header&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">block&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">header&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">[&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#c7bf54">~&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">]&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\w&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\n&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">block&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>[&amp;lt;&lt;span style="color:#00b1f7">pair&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#c7bf54">|&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">comment&lt;/span>&amp;gt;]&lt;span style="color:#c7bf54">*&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">rule&lt;/span> &lt;span style="color:#00b1f7">pair&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">key&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">=&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">value&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">comment&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">;&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\N&lt;/span>&lt;span style="color:#c7bf54">*&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\n&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">key&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\w&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">value&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#c7bf54">-&lt;/span>[&lt;span style="color:#d26464;font-weight:bold">\n&lt;/span>&lt;span style="color:#56b6c2"> ;&lt;/span>]&amp;gt;&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$match&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#c1abea">INIParser&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">parse&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span> &lt;span style="color:#c678dd">q&lt;/span>&lt;span style="color:#98c379">:to&lt;/span>/END/;&lt;span style="color:#98c379">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">; Comment
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">key1=value1
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">key2 = value2
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">; Section 1
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">[section1]
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">key3=value3
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#98c379">&lt;/span>END
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$match&lt;/span>&amp;lt;&lt;span style="color:#98c379">block&lt;/span>&amp;gt;&amp;lt;&lt;span style="color:#98c379">pair&lt;/span>&amp;gt;&lt;span style="color:#c7bf54">[&lt;/span>&lt;span style="color:#d19a66">0&lt;/span>&lt;span style="color:#c7bf54">]&lt;/span>&amp;lt;&lt;span style="color:#98c379">value&lt;/span>&amp;gt;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: ｢value1｣&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$match&lt;/span>&amp;lt;&lt;span style="color:#98c379">section&lt;/span>&amp;gt;&lt;span style="color:#c7bf54">[&lt;/span>&lt;span style="color:#d19a66">0&lt;/span>&lt;span style="color:#c7bf54">]&lt;/span>&amp;lt;&lt;span style="color:#98c379">block&lt;/span>&amp;gt;&amp;lt;&lt;span style="color:#98c379">pair&lt;/span>&amp;gt;&lt;span style="color:#c7bf54">[&lt;/span>&lt;span style="color:#d19a66">0&lt;/span>&lt;span style="color:#c7bf54">]&lt;/span>&amp;lt;&lt;span style="color:#98c379">value&lt;/span>&amp;gt;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: ｢value3｣&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">grammar&lt;/span> &lt;span style="color:#76a9f9">Calculator&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">TOP&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">calc-op&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">proto&lt;/span> &lt;span style="color:#c678dd">rule&lt;/span> &lt;span style="color:#00b1f7">calc-op&lt;/span> {&lt;span style="color:#c7bf54">*&lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">rule&lt;/span> &lt;span style="color:#00b1f7">calc-op&lt;/span>:&lt;span style="color:#b3d23c">sym&lt;/span>&amp;lt;&lt;span style="color:#98c379">add&lt;/span>&amp;gt; {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">num&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">+&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">num&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">rule&lt;/span> &lt;span style="color:#00b1f7">calc-op&lt;/span>:&lt;span style="color:#b3d23c">sym&lt;/span>&amp;lt;&lt;span style="color:#98c379">sub&lt;/span>&amp;gt; {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">num&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">-&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">num&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">num&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\d&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">class&lt;/span> &lt;span style="color:#76a9f9">Calculations&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">method&lt;/span> &lt;span style="color:#00b1f7">TOP&lt;/span> (&lt;span style="color:#dcaeea">$/&lt;/span>) { &lt;span style="color:#c678dd">make&lt;/span> &lt;span style="color:#dcaeea">$&amp;lt;calc-op&amp;gt;&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">made&lt;/span>; }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">method&lt;/span> &lt;span style="color:#00b1f7">calc-op&lt;/span>:&lt;span style="color:#b3d23c">sym&lt;/span>&amp;lt;&lt;span style="color:#98c379">add&lt;/span>&amp;gt; (&lt;span style="color:#dcaeea">$/&lt;/span>) { &lt;span style="color:#c678dd">make&lt;/span> &lt;span style="color:#c7bf54">[+]&lt;/span> &lt;span style="color:#dcaeea">$&amp;lt;num&amp;gt;&lt;/span>; }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">method&lt;/span> &lt;span style="color:#00b1f7">calc-op&lt;/span>:&lt;span style="color:#b3d23c">sym&lt;/span>&amp;lt;&lt;span style="color:#98c379">sub&lt;/span>&amp;gt; (&lt;span style="color:#dcaeea">$/&lt;/span>) { &lt;span style="color:#c678dd">make&lt;/span> &lt;span style="color:#c7bf54">[-]&lt;/span> &lt;span style="color:#dcaeea">$&amp;lt;num&amp;gt;&lt;/span>; }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c1abea">Calculator&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">parse&lt;/span>(&amp;#39;&lt;span style="color:#98c379">2 + 3&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#98c379">actions&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#c1abea">Calculations&lt;/span>)&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">made&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: «5␤»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">grammar&lt;/span> &lt;span style="color:#76a9f9">G&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">rule&lt;/span> &lt;span style="color:#00b1f7">TOP&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">function-define&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">rule&lt;/span> &lt;span style="color:#00b1f7">function-define&lt;/span> {&lt;span style="color:#56b6c2">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">sub&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">identifier&lt;/span>&amp;gt;&lt;span style="color:#56b6c2">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#56b6c2"> &lt;/span>{
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">say&lt;/span> &amp;#34;&lt;span style="color:#63c381">func &lt;/span>&amp;#34; &lt;span style="color:#c7bf54">~&lt;/span> &lt;span style="color:#dcaeea">$&amp;lt;identifier&amp;gt;&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">made&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">make&lt;/span> &lt;span style="color:#dcaeea">$&amp;lt;identifier&amp;gt;&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">made&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }&lt;span style="color:#56b6c2">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">(&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;lt;&lt;span style="color:#00b1f7">parameter&lt;/span>&amp;gt;&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">)&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">{&lt;/span>&amp;#39;&lt;span style="color:#56b6c2"> &lt;/span>&amp;#39;&lt;span style="color:#98c379">}&lt;/span>&amp;#39;&lt;span style="color:#56b6c2">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#56b6c2"> &lt;/span>{ &lt;span style="color:#ef8383">say&lt;/span> &amp;#34;&lt;span style="color:#63c381">end &lt;/span>&amp;#34; &lt;span style="color:#c7bf54">~&lt;/span> &lt;span style="color:#dcaeea">$/&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">made&lt;/span>; }&lt;span style="color:#56b6c2">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">identifier&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\w&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>{ &lt;span style="color:#c678dd">make&lt;/span> &lt;span style="color:#c7bf54">~&lt;/span>&lt;span style="color:#dcaeea">$/&lt;/span>; }&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">token&lt;/span> &lt;span style="color:#00b1f7">parameter&lt;/span> {&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\w&lt;/span>&lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#56b6c2"> &lt;/span>{ &lt;span style="color:#ef8383">say&lt;/span> &amp;#34;&lt;span style="color:#63c381">param &lt;/span>&amp;#34; &lt;span style="color:#c7bf54">~&lt;/span> &lt;span style="color:#dcaeea">$/&lt;/span>; }&lt;span style="color:#56b6c2"> &lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">G&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">parse&lt;/span>(&amp;#39;&lt;span style="color:#98c379">sub f ( a ) { }&lt;/span>&amp;#39;);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: «func f␤param a␤end f␤»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Inifinite and lazy list&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">@fib&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#d19a66">0&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span> &lt;span style="color:#c7bf54">+&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span> &lt;span style="color:#c7bf54">...&lt;/span> &lt;span style="color:#b756ff;font-weight:bold">∞&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">@fib&lt;/span>&lt;span style="color:#c7bf54">[^&lt;/span>&lt;span style="color:#d19a66">11&lt;/span>&lt;span style="color:#c7bf54">]&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (0 1 1 2 3 5 8 13 21 34 55)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Feed operator&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#dcaeea">@fib&lt;/span>&lt;span style="color:#c7bf54">[^&lt;/span>&lt;span style="color:#d19a66">20&lt;/span>&lt;span style="color:#c7bf54">]&lt;/span> &lt;span style="color:#c7bf54">==&amp;gt;&lt;/span> &lt;span style="color:#ef8383">grep&lt;/span>(&lt;span style="color:#dcaeea">&amp;amp;is-prime&lt;/span>) &lt;span style="color:#c7bf54">==&amp;gt;&lt;/span> &lt;span style="color:#ef8383">say&lt;/span>();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (2 3 5 13 89 233 1597)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Function composition&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">&amp;amp;reverse_primes&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#dcaeea">&amp;amp;reverse&lt;/span> &lt;span style="color:#c7bf54">∘&lt;/span> &lt;span style="color:#dcaeea">&amp;amp;grep&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">assuming&lt;/span>(&lt;span style="color:#dcaeea">&amp;amp;is-prime&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c1abea">reverse_primes&lt;/span> &lt;span style="color:#c7bf54">^&lt;/span>&lt;span style="color:#d19a66">20&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (19 17 13 11 7 5 3 2)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">@a&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>&lt;span style="color:#c7bf54">..&lt;/span>&lt;span style="color:#d19a66">4&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">@b&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &amp;#39;&lt;span style="color:#98c379">a&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">..&lt;/span>&amp;#39;&lt;span style="color:#98c379">d&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Zip two lists using Z meta operator&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">@a&lt;/span> &lt;span style="color:#b756ff;font-weight:bold">Z&lt;/span> &lt;span style="color:#dcaeea">@b&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: ((1 a) (2 b) (3 c) (4 d))&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">@a&lt;/span> &lt;span style="color:#b756ff;font-weight:bold">Z&lt;/span>&lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#dcaeea">@b&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (1 =&amp;gt; a 2 =&amp;gt; b 3 =&amp;gt; c 4 =&amp;gt; d)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Hyper Operators&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">@b&lt;/span> &lt;span style="color:#c7bf54">«~»&lt;/span> &lt;span style="color:#dcaeea">@a&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: [a1 b2 c3 d4]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Junctions&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &amp;#39;&lt;span style="color:#98c379">Find all the words starting with a lowercase vowel&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">words&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">grep&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span> &lt;span style="color:#c7bf54">*.&lt;/span>&lt;span style="color:#ef8383">starts-with&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span> &lt;span style="color:#ef8383">any&lt;/span> &amp;lt;&lt;span style="color:#98c379">a e i o u&lt;/span>&amp;gt;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (all a)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c1abea">ay&lt;/span> &amp;#39;&lt;span style="color:#98c379">🦋&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">chars&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &amp;#39;&lt;span style="color:#98c379">🦋&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">codes&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &amp;#39;&lt;span style="color:#98c379">🦋&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">encode&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">bytes&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$raku&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &amp;#39;&lt;span style="color:#98c379">راکو&lt;/span>&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$raku&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">chars&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$raku&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">uninames&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (ARABIC LETTER REH ARABIC LETTER ALEF ARABIC LETTER KEHEH ARABIC LETTER WAW)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$raku&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">comb&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: (ر ا ک و)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c7bf54">+&lt;/span>&lt;span style="color:#dcaeea">$raku&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">comb&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">subset&lt;/span> &lt;span style="color:#76a9f9">ℕ&lt;/span> &lt;span style="color:#c678dd">of&lt;/span> &lt;span style="color:#ef8383">Int&lt;/span> &lt;span style="color:#c678dd">where&lt;/span> &lt;span style="color:#c7bf54">*&lt;/span> &lt;span style="color:#c7bf54">&amp;gt;&lt;/span> &lt;span style="color:#d19a66">0&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#ef8383">f&lt;/span> (&lt;span style="color:#c1abea">ℕ&lt;/span> &lt;span style="color:#dcaeea">$a&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#c1abea">ℕ&lt;/span> &lt;span style="color:#dcaeea">$b&lt;/span> &lt;span style="color:#c678dd">--&amp;gt;&lt;/span> &lt;span style="color:#ef8383">Array&lt;/span> &lt;span style="color:#c678dd">of&lt;/span> &lt;span style="color:#76a9f9">ℕ&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">Array&lt;/span>&lt;span style="color:#c7bf54">[&lt;/span>&lt;span style="color:#c1abea">ℕ&lt;/span>&lt;span style="color:#c7bf54">].&lt;/span>&lt;span style="color:#ef8383">new&lt;/span>&lt;span style="color:#c7bf54">:&lt;/span> &lt;span style="color:#dcaeea">$a&lt;/span>²&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#dcaeea">$b&lt;/span>²;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#ef8383">f&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span>&lt;span style="color:#d19a66">2&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: [1 4]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Native Types&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#ef8383">int&lt;/span> &lt;span style="color:#dcaeea">@a&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#c7bf54">^&lt;/span>&lt;span style="color:#d19a66">10_000_000&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#c7bf54">[+]&lt;/span> &lt;span style="color:#dcaeea">@a&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: 49999995000000&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#ef8383">MAIN&lt;/span>(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">Str&lt;/span> &lt;span style="color:#dcaeea">$file&lt;/span> &lt;span style="color:#c678dd">where&lt;/span> &lt;span style="color:#c7bf54">*.&lt;/span>&lt;span style="color:#ef8383">IO&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">f&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &amp;#39;&lt;span style="color:#98c379">file.dat&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#c678dd">#= &lt;/span>&lt;span style="color:#7e97c3">an existing file to frobnicate
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span> &lt;span style="color:#ef8383">Int&lt;/span> :&lt;span style="color:#98c379">size&lt;/span>(&lt;span style="color:#c7bf54">:&lt;/span>&lt;span style="color:#dcaeea">$length&lt;/span>) &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#d19a66">24&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#c678dd">#= &lt;/span>&lt;span style="color:#7e97c3">length/size needed for frobnication
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span> &lt;span style="color:#ef8383">Bool&lt;/span> &lt;span style="color:#c7bf54">:&lt;/span>&lt;span style="color:#dcaeea">$verbose&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#c678dd">#= &lt;/span>&lt;span style="color:#7e97c3">required verbosity
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$length&lt;/span> &lt;span style="color:#c678dd">if&lt;/span> &lt;span style="color:#dcaeea">$length&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">defined&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">say&lt;/span> &lt;span style="color:#dcaeea">$file&lt;/span> &lt;span style="color:#c678dd">if&lt;/span> &lt;span style="color:#dcaeea">$file&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">defined&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">say&lt;/span> &amp;#39;&lt;span style="color:#98c379">Verbosity &lt;/span>&amp;#39;&lt;span style="color:#c7bf54">,&lt;/span> (&lt;span style="color:#dcaeea">$verbose&lt;/span> &lt;span style="color:#c7bf54">??&lt;/span> &amp;#39;&lt;span style="color:#98c379">on&lt;/span>&amp;#39; &lt;span style="color:#c7bf54">!!&lt;/span> &amp;#39;&lt;span style="color:#98c379">off&lt;/span>&amp;#39;);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># $ script-name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Usage:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># script-name [--size|--length=&amp;lt;Int&amp;gt;] [--verbose] [&amp;lt;file&amp;gt;]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># [&amp;lt;file&amp;gt;] an existing file to frobnicate&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># --size|--length=&amp;lt;Int&amp;gt; length/size needed for frobnication&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># --verbose required verbosity&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Using NativeCall to access libnotify and show a notification&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">use&lt;/span> &lt;span style="color:#ef8383">NativeCall&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#00b1f7">notify_init&lt;/span> (&lt;span style="color:#ef8383">str&lt;/span> &lt;span style="color:#dcaeea">$appname&lt;/span> &lt;span style="color:#c678dd">--&amp;gt;&lt;/span> &lt;span style="color:#ef8383">int32&lt;/span>) &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">native&lt;/span>(&amp;#39;&lt;span style="color:#98c379">notify&lt;/span>&amp;#39;) { &lt;span style="color:#c7bf54">*&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#c1abea">notify_uninit&lt;/span> &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">native&lt;/span>(&amp;#39;&lt;span style="color:#98c379">notify&lt;/span>&amp;#39;) { &lt;span style="color:#c7bf54">*&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">class&lt;/span> &lt;span style="color:#76a9f9">NotifyNotification&lt;/span> &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">repr&lt;/span>(&amp;#39;&lt;span style="color:#98c379">CPointer&lt;/span>&amp;#39;) { &lt;span style="color:#c7bf54">*&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#00b1f7">notify_notification_new&lt;/span> (&lt;span style="color:#ef8383">str&lt;/span> &lt;span style="color:#dcaeea">$summary&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#ef8383">str&lt;/span> &lt;span style="color:#dcaeea">$body&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#ef8383">str&lt;/span> &lt;span style="color:#dcaeea">$icon&lt;/span> &lt;span style="color:#c678dd">--&amp;gt;&lt;/span> &lt;span style="color:#c1abea">NotifyNotification&lt;/span>) &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">native&lt;/span>(&amp;#39;&lt;span style="color:#98c379">notify&lt;/span>&amp;#39;) { &lt;span style="color:#c7bf54">*&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">sub&lt;/span> &lt;span style="color:#00b1f7">notify_notification_show&lt;/span> (&lt;span style="color:#c1abea">NotifyNotification&lt;/span>) &lt;span style="color:#c678dd">is&lt;/span> &lt;span style="color:#c678dd">native&lt;/span>(&amp;#39;&lt;span style="color:#98c379">notify&lt;/span>&amp;#39;) { &lt;span style="color:#c7bf54">*&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">if&lt;/span> &lt;span style="color:#c1abea">notify_init&lt;/span> &amp;#39;&lt;span style="color:#98c379">MyApp&lt;/span>&amp;#39; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">notify_notification_show&lt;/span> &lt;span style="color:#c1abea">notify_notification_new&lt;/span> &amp;#39;&lt;span style="color:#98c379">My Notification&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">,&lt;/span> &amp;#39;&lt;span style="color:#98c379">Notification Body&lt;/span>&amp;#39;&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#ef8383">Str&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">notify_uninit&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Concurrency&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">react&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$current-proc&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">whenever&lt;/span> &lt;span style="color:#dcaeea">$script&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">watch&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">unique&lt;/span>(:&lt;span style="color:#98c379">as&lt;/span>(&lt;span style="color:#c7bf54">*.&lt;/span>&lt;span style="color:#ef8383">path&lt;/span>)&lt;span style="color:#c7bf54">,&lt;/span> :&lt;span style="color:#98c379">expires&lt;/span>(&lt;span style="color:#d19a66">1&lt;/span>)) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">kill&lt;/span> &lt;span style="color:#c678dd">with&lt;/span> &lt;span style="color:#dcaeea">$current-proc&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#dcaeea">$current-proc&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#ef8383">Proc::Async&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">new&lt;/span>(&lt;span style="color:#dcaeea;font-weight:bold">$*EXECUTABLE&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#dcaeea">$script&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$done&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#dcaeea">$current-proc&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#c678dd">start&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">whenever&lt;/span> &lt;span style="color:#dcaeea">$done&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#dcaeea">$current-proc&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#ef8383">Nil&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$modules-load&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#c678dd">start&lt;/span> &lt;span style="color:#dcaeea">@files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">grep&lt;/span>(/&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#d26464;font-weight:bold">\&lt;/span>&lt;span style="color:#56b6c2">.&lt;/span>(&lt;span style="color:#56b6c2">yaml&lt;/span>&lt;span style="color:#c7bf54">|&lt;/span>&lt;span style="color:#56b6c2">yml&lt;/span>)&lt;span style="color:#56b6c2"> &lt;/span>&lt;span style="color:#bda26f">$&lt;/span>/)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">sort&lt;/span>(&lt;span style="color:#c7bf54">-*.&lt;/span>&lt;span style="color:#ef8383">s&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">race&lt;/span>(&lt;span style="color:#98c379">batch&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#d19a66">1&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#98c379">degree&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#d19a66">6&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">map&lt;/span>(&lt;span style="color:#c678dd">-&amp;gt;&lt;/span> &lt;span style="color:#dcaeea">$file&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$yaml&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#ef8383">self&lt;/span>&lt;span style="color:#c7bf54">!&lt;/span>&lt;span style="color:#00b1f7">load-yaml&lt;/span>(&lt;span style="color:#dcaeea">$file&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#dcaeea">$schema&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#dcaeea">$problems&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">with&lt;/span> &lt;span style="color:#dcaeea">$yaml&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c1abea">Easii::Model::Module&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">new&lt;/span>(&lt;span style="color:#98c379">parsed&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#dcaeea">$yaml&lt;/span>&lt;span style="color:#c7bf54">,&lt;/span> &lt;span style="color:#98c379">source&lt;/span> &lt;span style="color:#c7bf54">=&amp;gt;&lt;/span> &lt;span style="color:#dcaeea">$file&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">basename&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> })
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">eager&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># Supply&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$bread-supplier&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#ef8383">Supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">new&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$vegetable-supplier&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#ef8383">Supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">new&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">my&lt;/span> &lt;span style="color:#dcaeea">$supply&lt;/span> &lt;span style="color:#c7bf54">=&lt;/span> &lt;span style="color:#c678dd">supply&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">whenever&lt;/span> &lt;span style="color:#dcaeea">$bread-supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">Supply&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">emit&lt;/span>(&amp;#34;&lt;span style="color:#63c381">We&amp;#39;ve got bread: &lt;/span>&amp;#34; &lt;span style="color:#c7bf54">~&lt;/span> &lt;span style="color:#dcaeea">$_&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> };
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c678dd">whenever&lt;/span> &lt;span style="color:#dcaeea">$vegetable-supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">Supply&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ef8383">emit&lt;/span>(&amp;#34;&lt;span style="color:#63c381">We&amp;#39;ve got a vegetable: &lt;/span>&amp;#34; &lt;span style="color:#c7bf54">~&lt;/span> &lt;span style="color:#dcaeea">$_&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> };
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#dcaeea">$supply&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">tap&lt;/span>(&lt;span style="color:#c678dd">-&amp;gt;&lt;/span> &lt;span style="color:#dcaeea">$v&lt;/span> { &lt;span style="color:#ef8383">say&lt;/span> &amp;#34;&lt;span style="color:#dcaeea">$v&lt;/span>&amp;#34; });
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#dcaeea">$vegetable-supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">emit&lt;/span>(&amp;#34;&lt;span style="color:#63c381">Radish&lt;/span>&amp;#34;);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: «We&amp;#39;ve got a vegetable: Radish␤» &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#dcaeea">$bread-supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">emit&lt;/span>(&amp;#34;&lt;span style="color:#63c381">Thick sliced&lt;/span>&amp;#34;);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: «We&amp;#39;ve got bread: Thick sliced␤» &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#dcaeea">$vegetable-supplier&lt;/span>&lt;span style="color:#c7bf54">.&lt;/span>&lt;span style="color:#ef8383">emit&lt;/span>(&amp;#34;&lt;span style="color:#63c381">Lettuce&lt;/span>&amp;#34;);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8a93a5;font-style:italic"># OUTPUT: «We&amp;#39;ve got a vegetable: Lettuce␤»&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#c678dd">=finish&lt;/span>&lt;span style="color:#7e97c3">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7e97c3">Goodbye!
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>An improved flycheck-raku now available on melpa [Emacs]</title><link>https://siavash.askari-nasr.com/blog/2021/03/16/improved-raku-flycheck-melpa-emacs/</link><pubDate>Tue, 16 Mar 2021 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2021/03/16/improved-raku-flycheck-melpa-emacs/</guid><description>&lt;p>Recently I forked the flycheck-raku (by @widefox) to the Raku GitHub organization.
And did some improvements to it and published it on &lt;a href="https://melpa.org/">melpa&lt;/a>, so others can easily install and update it.&lt;/p>
&lt;p>For those who don't know, &lt;a href="https://www.flycheck.org/">flycheck&lt;/a> is a tool for syntax checking Gnu Emacs buffers.&lt;/p>
&lt;p>You can install &lt;a href="https://github.com/Raku/flycheck-raku">flycheck-raku&lt;/a> using &lt;a href="https://github.com/jwiegley/use-package">use-package&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#ef8383">use-package&lt;/span> &lt;span style="color:#dcaeea">flychek-raku&lt;/span> &lt;span style="color:#ef8383">:ensure&lt;/span> &lt;span style="color:#b756ff;font-weight:bold">t&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="new-features" class="heading">
&lt;a href="#new-features">
New features
&lt;/a>
&lt;/h2>&lt;h3 id="project-detection" class="heading">
&lt;a href="#project-detection">
Project detection
&lt;/a>
&lt;/h3>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/emacs-flycheck-raku-could-not-find-module.png">
&lt;img
src="https://siavash.askari-nasr.com/img/emacs-flycheck-raku-could-not-find-module.png"
alt="Emacs - flycheck-raku - bare say"
/>
&lt;/a>&lt;/p>
&lt;p>Previously if you used &lt;code>flycheck-raku&lt;/code> on a project, it would show errors on &lt;code>use SomeModule;&lt;/code>,
even though the module was in the &lt;code>lib&lt;/code> directory of the project. And this would make &lt;code>flycheck&lt;/code> kinda
useless, because it wouldn't show further errors.&lt;/p>
&lt;p>But in the new version of &lt;code>flycheck-raku&lt;/code>, project root is detected and its &lt;code>lib&lt;/code> directory is added to
include path. So no more errors on valid modules.&lt;/p>
&lt;h3 id="error-pattern-improvements" class="heading">
&lt;a href="#error-pattern-improvements">
Error pattern improvements
&lt;/a>
&lt;/h3>&lt;h4 id="full-error-messages" class="heading">
&lt;a href="#full-error-messages">
Full error messages
&lt;/a>
&lt;/h4>&lt;p>Previous versions of &lt;code>flycheck-raku&lt;/code> would cut some long error messages. Now, error messages are fully shown.&lt;/p>
&lt;h4 id="multi-line-error-messages" class="heading">
&lt;a href="#multi-line-error-messages">
Multi-line error messages
&lt;/a>
&lt;/h4>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/emacs-flycheck-raku-bare-say.png">
&lt;img
src="https://siavash.askari-nasr.com/img/emacs-flycheck-raku-bare-say.png"
alt="Emacs - flycheck-raku - bare say"
/>
&lt;/a>&lt;/p>
&lt;p>In the new version, multi-line error messages are fully shown.&lt;/p>
&lt;h4 id="potential-difficulties" class="heading">
&lt;a href="#potential-difficulties">
Potential difficulties
&lt;/a>
&lt;/h4>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/emacs-flycheck-raku-symbol-redclaration.png">
&lt;img
src="https://siavash.askari-nasr.com/img/emacs-flycheck-raku-symbol-redclaration.png"
alt="Emacs - flycheck-raku - symbol redclaration"
/>
&lt;/a>&lt;/p>
&lt;p>New version shows potential difficulties; I've only seen one such error message and that is &lt;code>Redclaration of symbol $x&lt;/code>.&lt;/p></description></item><item><title>MovieInfo - A web app for finding movie information and ratings</title><link>https://siavash.askari-nasr.com/blog/2016/10/16/movieinfo-web-app-for-finding-movie-information-ratings/</link><pubDate>Sun, 16 Oct 2016 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2016/10/16/movieinfo-web-app-for-finding-movie-information-ratings/</guid><description>&lt;p>I wanted to create something that makes it easy for me to see movie ratings.
I decided to create it as a SPA. In order to do so, I had to find a good framework.
I looked at a few well known frameworks, but did not like any of them!&lt;/p>
&lt;p>I was going to give up, but then I saw &lt;a href="http://elm-lang.org/">Elm&lt;/a>.
I had seen it being mentioned here and there, but I had never looked into it.
So I decided to give it a try and started reading the
&lt;a href="https://guide.elm-lang.org/">guide&lt;/a> and the &lt;a href="http://elm-lang.org/docs">docs&lt;/a>.
I liked what I saw, so I did a bit more reading before starting the project.&lt;/p>
&lt;h2 id="movieinfo" class="heading">
&lt;a href="#movieinfo">
MovieInfo
&lt;/a>
&lt;/h2>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/MovieInfo-title.jpg">
&lt;img
src="https://siavash.askari-nasr.com/img/MovieInfo-title.jpg"
alt="MovieInfo - screenshot of a title"
/>
&lt;/a>&lt;/p>
&lt;p>I wanted the project to be very simple and light, so I created a simple interface,
and used the &lt;a href="https://omdbapi.com/">OMDb API&lt;/a> to show the necessary information.&lt;/p>
&lt;p>In addition to ratings from IMDB, Rotten Tomatoes and Metacritic,
I added an overall rating, which is the average of those ratings.&lt;/p>
&lt;p>&lt;a href="https://ciavash.gitlab.io/MovieInfo/">MovieInfo&lt;/a> is released under GPLv3+
and its source code is available &lt;a href="https://gitlab.com/CIAvash/MovieInfo">here&lt;/a>.&lt;/p>
&lt;p>&lt;strong>Update&lt;/strong>: I Recreated the app with &lt;a href="https://svelte.dev/">Svelte&lt;/a>: &lt;a href="https://movie-info.ciavash.name/">MovieInfo&lt;/a>&lt;/p></description></item><item><title>Get football information in your terminal with football</title><link>https://siavash.askari-nasr.com/blog/2016/05/12/get-soccer-information-in-your-terminal-with-football/</link><pubDate>Thu, 12 May 2016 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2016/05/12/get-soccer-information-in-your-terminal-with-football/</guid><description>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/football-leagues.png">
&lt;img
src="https://siavash.askari-nasr.com/img/football-leagues.png"
alt="Football Leagues"
/>
&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://gitlab.com/CIAvash/App-Football">App::Football&lt;/a> is a command line program I wrote in &lt;a href="https://raku-lang.ir/en">Raku&lt;/a>.
&lt;code>football&lt;/code> lets you access information regarding football(soccer!) teams, leagues, tables, fixtures, scores and players.&lt;/p>
&lt;p>It uses another module I wrote called &lt;a href="https://gitlab.com/CIAvash/WebService-FootballData">WebService::FootballData&lt;/a> which is a Raku interface for
&lt;a href="http://football-data.org">football-data.org&lt;/a> API.&lt;/p>
&lt;p>To install App::Football, you need to first install &lt;a href="https://raku-lang.ir/en/downloads/">Raku&lt;/a>
and &lt;a href="https://github.com/ugexe/zef">Zef&lt;/a>, then run:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>zef install App::Football
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;a href="https://gitlab.com/CIAvash/App-Football/blob/master/README.md">README&lt;/a> file has some useful examples,
but here are more examples and screenshots:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>football --team&lt;span style="color:#c7bf54">=&lt;/span>bayern --fixtures --timeframe&lt;span style="color:#c7bf54">=&lt;/span>p30 --venue&lt;span style="color:#c7bf54">=&lt;/span>away
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/football-bayern-away-fixtures.png">
&lt;img
src="https://siavash.askari-nasr.com/img/football-bayern-away-fixtures.png"
alt="Football - Bayern away fixtures"
/>
&lt;/a>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>football --team&lt;span style="color:#c7bf54">=&lt;/span>mancity --players
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/football-mancity-players.png">
&lt;img
src="https://siavash.askari-nasr.com/img/football-mancity-players.png"
alt="Football - Mancity players"
/>
&lt;/a>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>football --league&lt;span style="color:#c7bf54">=&lt;/span>pl --table --matchday&lt;span style="color:#c7bf54">=&lt;/span>&lt;span style="color:#d19a66">37&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/football-pl-table-matchday-37.png">
&lt;img
src="https://siavash.askari-nasr.com/img/football-pl-table-matchday-37.png"
alt="Football - PL matchday 37 table"
/>
&lt;/a>&lt;/p></description></item><item><title>How to type Raku unicode characters in Emacs</title><link>https://siavash.askari-nasr.com/blog/2016/01/09/entering-raku-unicode-characters-in-emacs/</link><pubDate>Sat, 09 Jan 2016 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2016/01/09/entering-raku-unicode-characters-in-emacs/</guid><description>&lt;p>&lt;a href="https://raku.org/">Raku programming language&lt;/a> uses some unicode characters as operators, quotation marks, etc.
In this post I'm going to explain how to type those characters in Emacs using
&lt;a href="http://www.emacswiki.org/emacs/InputMethods">input methods&lt;/a>.&lt;/p>
&lt;p>First, you might want to see a list of those characters and their ASCII equivalents
&lt;a href="https://docs.raku.org/language/unicode_ascii">here&lt;/a>.
There is also a doc for &lt;a href="https://docs.raku.org/language/unicode_entry">entering unicode characters&lt;/a>.
You may specifically want to look at &lt;a href="https://en.wikipedia.org/wiki/Compose_key#GNU.2FLinux">XCompose&lt;/a> for a system-wide solution.&lt;/p>
&lt;p>There are at least two input methods you can use to enter the unicode characters used in Raku.
&lt;a href="https://tools.ietf.org/html/rfc1345">rfc1345&lt;/a> and &lt;a href="http://www.emacswiki.org/emacs/TeXInputMethod">TeX&lt;/a>.&lt;/p>
&lt;p>To select an input method type &lt;code>C-x RET C-\&lt;/code> and to switch to an input method use &lt;code>C-u C-\&lt;/code>.
&lt;code>C-\&lt;/code> can be used to toggle input method.&lt;/p>
&lt;p>After you select an input method, You have to use the prefix character it provides for typing special characters.
&lt;code>&amp;amp;&lt;/code> is the prefix used for rfc1345 and &lt;code>\&lt;/code>, &lt;code>^&lt;/code> and some other characters are used for TeX.&lt;/p>
&lt;p>Example for typing λ:&lt;/p>
&lt;p>rfc1345: &lt;code>&amp;amp;l*&lt;/code>&lt;/p>
&lt;p>TeX: &lt;code>\lambda&lt;/code>&lt;/p>
&lt;p>To see a list of character sequences for an input method, type &lt;code>C-h I&lt;/code>.&lt;/p>
&lt;p>You can change the default input method by setting the &lt;code>default-input-method&lt;/code> variable:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#ef8383">setq&lt;/span> &lt;span style="color:#dcaeea">default-input-method&lt;/span> &lt;span style="color:#56b6c2">&amp;#39;TeX&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>To add characters which are not available in an input method:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#dcaeea">eval-after-load&lt;/span> &lt;span style="color:#98c379">&amp;#34;quail/latin-ltx&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">`&lt;/span>(&lt;span style="color:#ef8383">let&lt;/span> ((&lt;span style="color:#dcaeea">quail-current-package&lt;/span> (&lt;span style="color:#00b1f7">assoc&lt;/span> &lt;span style="color:#98c379">&amp;#34;TeX&amp;#34;&lt;/span> &lt;span style="color:#dcaeea">quail-package-alist&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#dcaeea">quail-define-rules&lt;/span> ((&lt;span style="color:#00b1f7">append&lt;/span> &lt;span style="color:#c7bf54">.&lt;/span> &lt;span style="color:#b756ff;font-weight:bold">t&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#98c379">&amp;#34;\\lcb&amp;#34;&lt;/span> &lt;span style="color:#98c379">?｢&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#98c379">&amp;#34;\\rcb&amp;#34;&lt;/span> &lt;span style="color:#98c379">?｣&lt;/span>))))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now with TeX method enabled, &lt;code>\lcb&lt;/code> types '｢' and &lt;code>\rcb&lt;/code> types '｣'.&lt;/p>
&lt;p>Same thing for the rfc1345 input method:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#dcaeea">eval-after-load&lt;/span> &lt;span style="color:#98c379">&amp;#34;quail/rfc1345&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#c7bf54">`&lt;/span>(&lt;span style="color:#ef8383">let&lt;/span> ((&lt;span style="color:#dcaeea">quail-current-package&lt;/span> (&lt;span style="color:#00b1f7">assoc&lt;/span> &lt;span style="color:#98c379">&amp;#34;rfc1345&amp;#34;&lt;/span> &lt;span style="color:#dcaeea">quail-package-alist&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#dcaeea">quail-define-rules&lt;/span> ((&lt;span style="color:#00b1f7">append&lt;/span> &lt;span style="color:#c7bf54">.&lt;/span> &lt;span style="color:#b756ff;font-weight:bold">t&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#98c379">&amp;#34;&amp;amp;[&amp;#34;&lt;/span> &lt;span style="color:#98c379">&amp;#34;｢&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#98c379">&amp;#34;&amp;amp;]&amp;#34;&lt;/span> &lt;span style="color:#98c379">&amp;#34;｣&amp;#34;&lt;/span>))))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now with the rfc1345 method you can type '｢' with &lt;code>&amp;amp;[&lt;/code> and type '｣' with &lt;code>&amp;amp;]&lt;/code>.&lt;/p>
&lt;p>Another way of entering unicode characters is using &lt;code>C-x 8 RET&lt;/code> which runs &lt;code>insert-char&lt;/code> command.
&lt;code>C-x 8&lt;/code> prefix key has shortcuts for some characters. For example, &lt;code>C-x 8 / /&lt;/code> inserts ÷. To add your own characters:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#dcaeea">global-set-key&lt;/span> (&lt;span style="color:#dcaeea">kbd&lt;/span> &lt;span style="color:#98c379">&amp;#34;C-x 8 l&amp;#34;&lt;/span>) &lt;span style="color:#98c379">&amp;#34;λ&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#dcaeea">global-set-key&lt;/span> (&lt;span style="color:#dcaeea">kbd&lt;/span> &lt;span style="color:#98c379">&amp;#34;C-x 8 l&amp;#34;&lt;/span>) (&lt;span style="color:#ef8383">lambda&lt;/span> () (&lt;span style="color:#ef8383">interactive&lt;/span>) (&lt;span style="color:#00b1f7">insert&lt;/span> &lt;span style="color:#98c379">&amp;#34;λ&amp;#34;&lt;/span>)))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now &lt;code>C-x 8 l&lt;/code> inserts λ.&lt;/p>
&lt;p>Below is a list of unicode characters used in Raku and their character sequences in rfc1345 and TeX.&lt;/p>
&lt;p>&lt;strong>Note&lt;/strong>: rfc1345 character mnemonics work in Vim too. You only need to replace &lt;code>&amp;amp;&lt;/code> with &lt;code>Ctrl-K&lt;/code>.&lt;/p>
&lt;table class="table">
&lt;thead>
&lt;tr>
&lt;th style="text-align: center">Character&lt;/th>
&lt;th style="text-align: center">C-x 8&lt;/th>
&lt;th style="text-align: center">rfc1345&lt;/th>
&lt;th style="text-align: center">TeX&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: center">«&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;lt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;&amp;lt;&amp;lt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\flqq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">»&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;&amp;gt;&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\frqq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">×&lt;/td>
&lt;td style="text-align: center">&lt;code>x&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;*X&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\times&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">÷&lt;/td>
&lt;td style="text-align: center">&lt;code>/ /&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;-:&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\div&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">−&lt;/td>
&lt;td style="text-align: center">&lt;code>_ -&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;-2&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\minus&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">≤&lt;/td>
&lt;td style="text-align: center">&lt;code>_ &amp;lt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;=&amp;lt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\le&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">≥&lt;/td>
&lt;td style="text-align: center">&lt;code>_ &amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;&amp;gt;=&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\ge&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">≠&lt;/td>
&lt;td style="text-align: center">&lt;code>/ =&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;!=&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\ne&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∘&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;Ob&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\circ&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">≅&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;?=&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\cong&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">π&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;p*&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\pi&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">τ&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;t*&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\tau&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∞&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;00&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\infty&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">…&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;.3&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\ldots&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">‘&lt;/td>
&lt;td style="text-align: center">&lt;code>[&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;'6&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\rq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">’&lt;/td>
&lt;td style="text-align: center">&lt;code>]&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;'9&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\lq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">‚&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;.9&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\glq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">“&lt;/td>
&lt;td style="text-align: center">&lt;code>{&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;&amp;quot;6&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\ldq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">”&lt;/td>
&lt;td style="text-align: center">&lt;code>}&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;&amp;quot;9&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\rdq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">„&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;:9&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\glqq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">¯&lt;/td>
&lt;td style="text-align: center">&lt;code>=&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;'m&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\={}&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⁻&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;-S&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>^-&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⁺&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;+S&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>^+&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⁰ - ⁹&lt;/td>
&lt;td style="text-align: center">&lt;code>^ 1&lt;/code> - &lt;code>^ 3&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;0S&lt;/code> - &lt;code>&amp;amp;9S&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>^0&lt;/code> - &lt;code>^9&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">½&lt;/td>
&lt;td style="text-align: center">&lt;code>1 / 2&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;12&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\frac12&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∅&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;/0&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\emptyset&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∈&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;(-&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\in&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∉&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\notin&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∋&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;-)&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\ni&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊆&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;(_&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\subseteq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊈&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\nsubseteq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊂&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;(C&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\subset&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊄&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\nsubset&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊇&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;)_&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\supseteq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊉&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\nsupseteq&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊃&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;(C&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\supset&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊅&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\nsupset&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∪&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;)U&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\cup&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∩&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;(U&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\cap&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">∖&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\setminus&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊖&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\ominus&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">⊎&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\uplus&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">≡&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>&amp;amp;=3&lt;/code>&lt;/td>
&lt;td style="text-align: center">&lt;code>\equiv&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">≢&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;/td>
&lt;td style="text-align: center">&lt;code>\nequiv&lt;/code>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table></description></item><item><title>Magrent 1.0 released [Firefox]</title><link>https://siavash.askari-nasr.com/blog/2014/06/04/magrent-1-0-released/</link><pubDate>Wed, 04 Jun 2014 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2014/06/04/magrent-1-0-released/</guid><description>&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/Magrent-Panel.png">
&lt;img
src="https://siavash.askari-nasr.com/img/Magrent-Panel.png"
alt="Magrent-Panel"
/>
&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/magrent/">Magrent&lt;/a> 1.0 adds context menu items to torrent info hash(when hash is selected) and The Pirate Bay torrent pages and links.&lt;/p>
&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/Magrent-ContextMenu.png">
&lt;img
src="https://siavash.askari-nasr.com/img/Magrent-ContextMenu.png"
alt="Magrent-ContextMenu"
/>
&lt;/a>&lt;/p>
&lt;p>Changes in this version:&lt;/p>
&lt;ul>
&lt;li>Add support for The Pirate Bay torrent URLs and links&lt;/li>
&lt;li>Add context menu items for torrent info hashes&lt;/li>
&lt;li>New design for Magrent panel&lt;/li>
&lt;li>Use new action buttons(Australis) with backwards compatibility.&lt;/li>
&lt;li>New icon&lt;/li>
&lt;li>Notify user when torrent source is not accessible.&lt;/li>
&lt;li>Add torrent source name to the notification title&lt;/li>
&lt;/ul></description></item><item><title>Simple parser for C language</title><link>https://siavash.askari-nasr.com/blog/2013/07/02/simple-parser-for-c-language/</link><pubDate>Tue, 02 Jul 2013 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2013/07/02/simple-parser-for-c-language/</guid><description>&lt;p>For a long time I'v wanted to push my Parser project which was a university project for Principles of Compiler Design course to GitHub. Now I’v found the time to do it and you can download it &lt;a href="https://github.com/CIAvash/simple-c-parser/">here&lt;/a>.&lt;/p>
&lt;p>2 years ago I started learning Perl, soon Perl became my favourite programming language. It was then that our professor gave us the scanner project for C language. He told us that we can use the programming language of our choice. We were also allowed to use regular expressions. So I thought Perl is the best language for writing the project. In a month I read &lt;a href="http://en.wikipedia.org/wiki/Learning_Perl">Learning Perl&lt;/a> book and other necessary stuff and became ready to write the scanner. Scanner was my first Perl project. When I gave the project to professor, he said that I was the first person who has written the project in Perl :)&lt;/p>
&lt;p>After Scanner, professor gave us a simple C grammar for a parser project. I wrote that in Perl too. The result (with a little change) is &lt;a href="https://github.com/CIAvash/simple-c-parser/">here&lt;/a>.&lt;/p>
&lt;p>The used grammar exists in the documents directory. Along with other things that are produced from grammar: the LL(1) grammar after left factoring and left recursion removal, FIRST and FOLLOW sets and the parse table.&lt;/p>
&lt;p>Take a look at the README.md for its usage and some dummy C code for using in scanner and parser.&lt;/p>
&lt;p>Usage:&lt;/p>
&lt;p>scanner:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>./scanner.pl &lt;span style="color:#c7bf54">[&lt;/span>file_name&lt;span style="color:#c7bf54">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Output: Symbol Table (tokens)&lt;/p>
&lt;p>parser:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>./parser.pl &lt;span style="color:#c7bf54">[&lt;/span>-s&lt;span style="color:#c7bf54">]&lt;/span> &lt;span style="color:#c7bf54">[&lt;/span>file_name&lt;span style="color:#c7bf54">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Output: Table of parsing process&lt;/p>
&lt;p>With -s switch you can also see the scanner's output.&lt;/p>
&lt;p>&lt;a href="https://github.com/CIAvash/simple-c-parser/">Simple C Parser on GitHub&lt;/a>&lt;/p></description></item><item><title>Restoring GRUB with Arch linux live CD</title><link>https://siavash.askari-nasr.com/blog/2012/12/11/restoring-grub-with-arch-linux-live-cd/</link><pubDate>Tue, 11 Dec 2012 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2012/12/11/restoring-grub-with-arch-linux-live-cd/</guid><description>&lt;p>I had Arch linux on my computer and needed Windows for gaming; Windows installs its own boot loader, so I had to re-install grub. The following is what I did to restore grub.&lt;/p>
&lt;p>I suppose that you know what you're doing! For example you need to know in which partition linux is installed.&lt;/p>
&lt;p>Boot Arch linux from live CD.&lt;/p>
&lt;p>Create a directory for &lt;a href="https://wiki.archlinux.org/index.php/Change_Root">chroot&lt;/a> environment:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mkdir /mnt/root
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Mount the root partition and other necessary device and file systems:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mount /dev/sda1 /mnt/root
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">cd&lt;/span> /mnt/root
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount -o &lt;span style="color:#ef8383">bind&lt;/span> /dev dev/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount -t proc proc proc/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount -t sysfs sys sys/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>It seems that on newer Arch releases(2012), you can use &lt;code>arch-chroot /mnt/root&lt;/code> instead of the last 3 mount commands.&lt;/p>
&lt;p>If you have a separate partition for boot, mount it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mount /dev/&lt;span style="color:#c7bf54">[&lt;/span>boot partition&lt;span style="color:#c7bf54">]&lt;/span> boot/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Change the root:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>chroot .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can define another shell by adding it to the above command, like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>chroot . /bin/bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Generate grub.cfg file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grub-mkconfig -o /boot/grub/grub.cfg
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Install GRUB:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grub-install /dev/sda
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Exit the chroot environment:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">exit&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Unmount filesystems and devices:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>umount &lt;span style="color:#c7bf54">{&lt;/span>dev,proc,sys,&lt;span style="color:#c7bf54">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Unmount the root partition:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ef8383">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>umount root
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And finally, you can reboot:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#b0c4de;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>reboot
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>My move from Ubuntu to Arch Linux</title><link>https://siavash.askari-nasr.com/blog/2012/11/12/move-from-ubuntu-to-arch-linux/</link><pubDate>Mon, 12 Nov 2012 00:00:00 +0000</pubDate><author>CIAvash</author><guid>https://siavash.askari-nasr.com/blog/2012/11/12/move-from-ubuntu-to-arch-linux/</guid><description>&lt;p>About a month ago I decided to try a new linux distribution. I was using Ubuntu and was even waiting for Ubuntu 12.10. I chose &lt;a href="https://www.archlinux.org/">Arch Linux&lt;/a> for testing, and Installed it on my netbook. I really liked the installation process! Then I chose &lt;a href="http://xfce.org/">Xfce&lt;/a> as Desktop Environment. After a few days I decided to move from Ubuntu to Arch Linux.&lt;/p>
&lt;p>When I read an article about a window manager, I was reminded of Tiling Window Managers so I decided to check window managers before moving. After some reading and comparing, I chose &lt;a href="http://xmonad.org/">xmonad&lt;/a> as my window manager.&lt;/p>
&lt;p>So I installed Arch Linux with xmonad. I spent a few days on installing softwares and configuring. You can see the result in the below picture.&lt;/p>
&lt;p>&lt;a href="https://siavash.askari-nasr.com/img/arch-linux-xmonad-CIAvash.png">
&lt;img
src="https://siavash.askari-nasr.com/img/arch-linux-xmonad-CIAvash.png"
alt="arch-linux-xmonad"
/>
&lt;/a>&lt;/p>
&lt;p>There is still a lot to learn about Arch Linux and xmonad, but I know enough to do the things I need to do.&lt;/p>
&lt;p>If you want to try Arch Linux, the &lt;a href="https://wiki.archlinux.org/index.php/Beginners%27_Guide">Beginners' Guide&lt;/a> is the best place to start.&lt;/p>
&lt;p>&lt;a href="http://www.haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen%27s_Configuration">This guide&lt;/a> is a good start on configuring xmonad. Other useful links:&lt;/p>
&lt;p>&lt;a href="http://xmonad.org/tour.html">xmonad : a guided tour&lt;/a>&lt;/p>
&lt;p>&lt;a href="http://www.haskell.org/haskellwiki/Xmonad/Config_archive">Xmonad/Config archive – HaskellWiki&lt;/a>&lt;/p>
&lt;p>Some of the Applications I use:(updated)&lt;/p>
&lt;ul>
&lt;li>Firefox&lt;/li>
&lt;li>Thunderbird&lt;/li>
&lt;li>GNU Emacs (text editor and more!)&lt;/li>
&lt;li>Guake (terminal)&lt;/li>
&lt;li>zsh (shell)&lt;/li>
&lt;li>tmux (terminal multiplexer)&lt;/li>
&lt;li>xmobar (status bar)&lt;/li>
&lt;li>dmenu (application launcher)&lt;/li>
&lt;li>dunst (notification daemon)&lt;/li>
&lt;li>Krusader, Dolphin (file manager)&lt;/li>
&lt;li>ncmpcpp (music player)&lt;/li>
&lt;li>mpv (media player)&lt;/li>
&lt;li>feh, ristretto (image viewer)&lt;/li>
&lt;li>scrot (screenshot)&lt;/li>
&lt;li>zathura (PDF viewer)&lt;/li>
&lt;li>Liferea (feed reader)&lt;/li>
&lt;li>syncthing, btsync, dropbox (sync, backup)&lt;/li>
&lt;/ul></description></item></channel></rss>