<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Iuri L Machado on Medium]]></title>
        <description><![CDATA[Stories by Iuri L Machado on Medium]]></description>
        <link>https://medium.com/@machadoiuri?source=rss-699af3ad91e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4Qy5MlqXk-Xe8KglgWQXwg.jpeg</url>
            <title>Stories by Iuri L Machado on Medium</title>
            <link>https://medium.com/@machadoiuri?source=rss-699af3ad91e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 02:22:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@machadoiuri/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Clojure tips for beginners]]></title>
            <link>https://medium.com/@machadoiuri/clojure-tips-for-beginners-64830b8ef589?source=rss-699af3ad91e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/64830b8ef589</guid>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[clojure]]></category>
            <category><![CDATA[lisp]]></category>
            <dc:creator><![CDATA[Iuri L Machado]]></dc:creator>
            <pubDate>Sun, 05 Nov 2017 05:37:41 GMT</pubDate>
            <atom:updated>2017-11-05T05:38:46.302Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Yes, this post is about Clojure. It’s from a Clojure beginner. Don’t expect anything too fancy in this post if you are a Clojure kung-fu panda.</p><ul><li>If you already know Functional Programming, it’s just a leap of faith. Clojure is awesome, I couldn’t find anything that allows me to write and express code with such a short span of words.</li><li>Yes, parenthesis are quite confusing… sometimes. In a week, your eyes get used to it.</li><li>Everything is seq-able: Java collections, Clojure collections, IO Streams, etc... If your mom was a collection it would be seq-able. Use and abuse the seq-able functions as you please.</li><li>seq-able functions are <em>lazy</em>. This means you can handle huge files or infinite streams of data without caring much about the amounts of memory you are going to use. Just remember to use take if you want to see something happening in the REPL.</li><li>REPL. Use it!</li><li>Interoperability with the JVM is straightforward and quite natural.</li><li>Clojure has quite awesome abstractions to deal with concurrency and parallelism. agents, atoms, refs, vars — the so called “persistent data-structures” — and core.async. With the first 3, remember to use @ (short for deref).</li><li>spec is an awesome tool that makes me thing if Strong, Static Typing is really useful.</li><li>Transducers are just a scary word. Technically, they are reducers on steroids.</li><li>Protocols are Interfaces on steroids.</li><li>There are quite good references to learn Clojure and Clojurescript, which are similar and quite different at the same time. These are in the final section of this post.</li><li>It’s quite a lot of stuff to learn. Don’t dive too deep at once.</li></ul><p>It has been quite a journey. I remember when I first learned LISP to use with EMACS.</p><p>Anyway, here are the refereces I’m using:</p><ul><li><a href="https://www.braveclojure.com/clojure-for-the-brave-and-true/">https://www.braveclojure.com/clojure-for-the-brave-and-true/</a></li><li><a href="https://pragprog.com/book/shcloj3/programming-clojure-third-edition">https://pragprog.com/book/shcloj3/programming-clojure-third-edition</a></li><li><a href="https://www.packtpub.com/web-development/learning-clojurescript">https://www.packtpub.com/web-development/learning-clojurescript</a></li><li><a href="https://pragprog.com/book/dswdcloj2/web-development-with-clojure-second-edition">https://pragprog.com/book/dswdcloj2/web-development-with-clojure-second-edition</a></li></ul><p>Enjoy LISPin’</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64830b8ef589" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello Macaw Web Framework]]></title>
            <link>https://medium.com/@machadoiuri/hello-macaw-web-framework-3ce5a8d0dbaf?source=rss-699af3ad91e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ce5a8d0dbaf</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[fsharp]]></category>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[elixir]]></category>
            <dc:creator><![CDATA[Iuri L Machado]]></dc:creator>
            <pubDate>Mon, 21 Nov 2016 16:10:17 GMT</pubDate>
            <atom:updated>2016-11-21T19:35:18.576Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Since I started using F#, I’ve really enjoyed much of what I’ve seen. Not only the strong, statically typed nature of the language makes everything easy to use, refactor and reason with, but the F# ecosystem is really awesome.</p><p>After being chosen as a mentee by the F# Software Foundation, I’ve decided to give a shot and write my own web framework. But using a very different approach, comparing with the other ones in the F# ecosystem, such as Suave, Freya and WebSharper. Being an Erlang guy that have used Elixir and Phoenix for quite a while and I’ve to say they are amazing pieces of technology and I think that Phoenix was the right direction to build modern, realtime webapps.</p><p>So, Phoenix is my inspiration to build Macaw. And, as Phoenix, I’ve some quite straightforward goals in mind: performance, ease to use and concurrency. My plans are to build the following:</p><ul><li>Pipes — the library to interact with the OWIN. My final plan is to support the entire OWIN specification and provide a functional way to use it. As the name suggests, making mutations to the OWIN environment by using pipelines.</li><li>Plume — a view engine, inspired by Elm. The solely reason for writing my own view engine instead of using others is that I plan for it to be compiled, so rendering should be really fast.</li><li>Nest — the data access. By leveraging F#’s SQLProvider library, we can have something that really resembles Elixir’s Ecto library. My plan is to wrap it and provide a migration tool as well.</li><li>Dome — is the presence library, inspired by Phoenix’s presence library.</li><li>Macaw — the web framework itself, where we glue everything together.</li></ul><p>Some of these libraries (in special the presence one) will have adapters to other libraries, such as Akka.NET, Orleans, etc… So, as we can see, there is a load of work that needs to be done. I won’t finish this all during the mentorship program but I have hopes that, at least half of this stuff is completed by then. I find the challenge quite amusing and I’ve been learning tons of stuff on the process.</p><p>If you wish to follow, contribute and/or give suggestions, be my guest: <a href="https://github.com/macawframework">https://github.com/macawframework</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ce5a8d0dbaf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first month working with F# daily]]></title>
            <link>https://medium.com/@machadoiuri/my-first-month-working-with-f-daily-c8c1b9c84dd8?source=rss-699af3ad91e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8c1b9c84dd8</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[fsharp]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Iuri L Machado]]></dc:creator>
            <pubDate>Tue, 26 Jul 2016 12:07:46 GMT</pubDate>
            <atom:updated>2016-07-26T13:03:21.825Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Yesterday I completed my first month using F# in a daily basis. I might say that the “adventure” was somewhat refreshing and quite enjoyable. There are so many gems hidden inside the .NET world (in special inside the F# world) and I want to say to everyone that works with C#/VB that you <strong>should </strong>try, for at least one month. You will start seeing the power and expressiveness behind it.</p><p>The first thing that I want to tell you is that, by no means I’m an .NET expert. To be fair, I’m a .NET newbie that knows some F#. Not a lot but I’m comfortable enough to write not sucking code (this is due to my functional programming background).</p><p>So, as I said, there are so many gems inside .NET and F# is one of them. Why, you might ask? Well, let me tell you that F# has some features that are game winners when you talk about productivity, safety and good written code. Let me tell you about some of them:</p><ol><li><strong>No circular dependencies</strong>. All your files are compiled in a pre-defined order, so you <strong>cannot</strong> use something from <strong><em>Foo </em></strong>module if they are not declared before. This looks odd but leads to understandable, well designed code in the long run, since circular dependencies are evil (and tends to lead to hours of trying to understand dependencies between objects).</li><li><strong>Immutable data as default</strong>. This is great when writing concurrent programs. Not needing to deal with threads, locks and mutexes makes everyone’s day more enjoyable.</li><li><strong>Strong Type System</strong>. Since F# is a ML family language — the same from OCaml, Haskell, Elm — the types are your friends. I find that declaring types as your domain and what actions can be done with your domain a great way to write good code. Strong typing has the advantage of letting the compiler do extra work for you by guaranteeing that your <strong>functions arguments</strong> and <strong>return values</strong> are <strong>consistent</strong>. This directly leads to: when the actions in your domain change (also know as business model’s rules) — and they often change — it will guarantee that your program will not compile until you solve all inconsistencies in your code. Quite neat!</li><li><strong>Type providers</strong>. This for me is a killer feature in F#. Imagine you reading a CSV, XML or JSON file. Instead of writing the model, F# data/type providers infer the data structure for you automatically, with types, and with Intellisense! All you need to do is to import the file using the Type provider functions are you are done with it. Now imagine extending this feature to REST APIs, databases, other languages’ code. Who needs ORMs when you have the power of F# Types and LINQ.</li><li><strong>Asynchronous semantics</strong>. When you use functional programming, most of the time you’ll be building your logic on top of Collections (Seq, Array…). In imperative languages, it’s hard to parallelize loops, because you are mutating data and the job rapidly becomes a nightmare. In F#, you can wire up your code inside an <strong><em>async{}</em></strong> block and change all your functions, like <strong><em>map </em></strong>to <strong><em>pmap</em></strong>. That’s it, you are done. Go home.</li></ol><p>And there are more… but I won’t spoil all the fun of discovery. I’ll just write names and let you do the heavy lifting: <strong>pattern matching</strong>, <strong>active patterns</strong>, <strong>operator definition</strong> <strong>and overload </strong>(use with care), <strong>computation expressions</strong> and <strong>quotations </strong>(metaprogramming). Give a try on F#, there are many chances that you’ll fell in love with it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8c1b9c84dd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Erlanger in the midst of Elixiers]]></title>
            <link>https://medium.com/@machadoiuri/an-erlanger-in-the-midst-of-elixiers-b43f1cb31f03?source=rss-699af3ad91e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b43f1cb31f03</guid>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[meetup]]></category>
            <dc:creator><![CDATA[Iuri L Machado]]></dc:creator>
            <pubDate>Wed, 07 Oct 2015 02:18:39 GMT</pubDate>
            <atom:updated>2015-10-11T18:04:31.475Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Last week I went on a MeetUp about Elixir here in Rio de Janeiro. The very first on its kind. It was just amazing to see people discussing and asking questions about the language, the runtime system, how to architecture systems, just to name a few. It’s also cool to see how Elixir could make the environment around Erlang and the BEAM (its virtual machine) grow as a whole. So, since I use Erlang for about two years, I decided to summarize some of the doubts and questions that rose on the meeting with its answers altogether. Be in mind, I’m also learning, far from being an expert, so some stuff here might be wrong or incomplete. If you find any inconsistencies, please let me know.</p><p>For those who do not know Elixir, it is a programming language that looks like Ruby and feels like Erlang. And for those who does not know Erlang, well it’s like a grandpa (it is more than 15 years old) that looks like Prolog and has a Virtual Machine tuned for developing resilient systems. It was developed by Ericsson first for their Telecom but now it’s more of a general-use for distributed systems and applications. And if you don’t know Prolog, then I cannot help you but point you out onto <a href="https://en.wikipedia.org/wiki/Prolog">this</a> link on Wikipedia.</p><p>So, now with the questions:</p><h3>What is OTP and why it is so important?</h3><p>OTP stands for Open Telecom Platform. Nowadays, it is not only about Telecom, but also fault tolerant, distributed applications. It is available to both languages and should be used. Using OTP libraries guarantees that your code is not only resilient against all types of failures that might happen (nodes going down, problems with logic, invalid state, etc..) but also that your code can be run in a concurrent way. You can have thousands of hundreds of processes running on the same machine with almost no increase of internal latency. Also, the BEAM starts a number of internal schedulers to distribute load between your machine cores.</p><h3>How processes work?</h3><p>Since I’ve said that the amount of schedulers is equal to the amount of cores and, the BEAM can distribute the process load around these, you might be thinking about the number of process you should and can spawn. The answers are: “as many as you can” and “as many as the BEAM allows you to”. Really. Don’t be afraid. These processes have nothing to do with the Operational System processes. They are internal processes handled by BEAM itself. Oh, by the way, BEAM allows you a maximum of <em>32,768 </em>processes by default, but you can change that.</p><p>Each process has a share of 2000 reductions. When the task eats up all their reductions, it is put back on top of the stack so others can work. This is why Erlang has the lowest latency of all languages that runs on a VM. As an example, imagine that I have 100 tasks to be handled by the runtime system of Haskell or Go and 100 of Erlang. Task 1 consumes around <em>100 ms</em> to be completed. This means that in Go or Haskell, the system would have to wait for the task 1 be completed before switching to tasks 2–100, while in Erlang, when all the reductions of task 1 finishes (which should be sub <em>1 ms</em>) it jumps to tasks 2–100, so all tasks get a fair share. This is called pre-emptive multitasking. For more on the subject, follow <a href="https://en.wikipedia.org/wiki/Preemption_%28computing%29">this</a> and <a href="http://jlouisramblings.blogspot.com.br/2013/01/how-erlang-does-scheduling.html">this</a> link.</p><h3>How is the architecture of an application written in Erlang/Elixir?</h3><p>So OTP gives up a very basic set of “rules” for us to build our applications and libraries. These are called Behaviours. But before I dig a little on behaviours, it might be very enlightening to understand the difference between an application and a library in Erlang. So, bear in mind that there is no convention here, usually libraries do not spawn processes, or have a “supervised control chain”. Does not make sense at all? Let me explain.</p><p>OTP comes with 4 flavours of behaviours. These are, <em>supervisor</em>, <em>gen_server</em>, <em>gen_event</em> and <em>gen_fsm</em>. All these behaviours come with batteries included! I’ll not enter into much detail here, I might write a post later explaining how to deal with every one of these behaviours.</p><h4>The Overseer: supervisor</h4><p>Supervisors are on the top of the chain. Their responsibility is to start, stop and monitor their <em>child processes</em>. Note that Supervisors can be supervised by other Supervisor as well!</p><h4>The Worker of Many Hours: gen_server</h4><p>I name it as a worker because, well, it is where you will be writing your applications <em>97%</em> of the time! The fact is, <em>gen_server</em> is sufficiently generic for general usage. And in Erlang, you can think of using <em>gen_server</em> every-time you need to do client-server communication.</p><h4>The Big Monster of Many Known Faces: gen_fsm</h4><p>Despite naming it a monster, <em>gen_fsm</em> is nothing more, nothing less than a Finite State Machine. You have a <em>state </em>A, when an <em>event E</em> occurs you should take an <em>action X</em> and go to <em>state B</em>. That’s all.</p><h4>The Manager of All Hours: gen_event</h4><p>If you need to manage something then you should hire a <em>gen_event </em>to do the job for you. They are event managers.</p><h3>To sum up everything…</h3><p>There are much more stuff I would like to cover but, time’s short and I doubt you would read everything if I keep this going more than what I already is. I hope this was clarifying enough for you, aspiring BEAMsters. Good learning and coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b43f1cb31f03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>