<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Pedro Matiello</title><link>https://www.pmatiello.me/posts/</link><description>Recent content in Posts on Pedro Matiello</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 25 Apr 2023 22:30:00 +0000</lastBuildDate><atom:link href="https://www.pmatiello.me/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Announcement: me.pmatiello/openai-api</title><link>https://www.pmatiello.me/posts/2023-04-25-announcement-mepmatielloopenai-api/</link><pubDate>Tue, 25 Apr 2023 22:30:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2023-04-25-announcement-mepmatielloopenai-api/</guid><description>&lt;p&gt;&lt;code&gt;me.pmatiello/openai-api&lt;/code&gt; is a pure-Clojure wrapper around
the &lt;a href="https://platform.openai.com/"&gt;OpenAI API&lt;/a&gt;, offering various functions for
interacting with the API&amp;rsquo;s capabilities. These include text generation, image
generation and editing, embeddings, audio transcription and translation, file
management, fine-tuning, and content moderation.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-clj" data-lang="clj"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;require&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#111"&gt;[&lt;/span&gt;&lt;span style="color:#111"&gt;me.pmatiello.openai-api.api&lt;/span&gt; &lt;span style="color:#d88200"&gt;:as&lt;/span&gt; &lt;span style="color:#111"&gt;openai&lt;/span&gt;&lt;span style="color:#111"&gt;])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#00a8c8"&gt;def &lt;/span&gt;&lt;span style="color:#111"&gt;credentials&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;openai/credentials&lt;/span&gt; &lt;span style="color:#111"&gt;api-key&lt;/span&gt;&lt;span style="color:#111"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;openai/chat&lt;/span&gt; &lt;span style="color:#111"&gt;{&lt;/span&gt;&lt;span style="color:#d88200"&gt;:model&lt;/span&gt; &lt;span style="color:#d88200"&gt;&amp;#34;gpt-3.5-turbo&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#d88200"&gt;:messages&lt;/span&gt; &lt;span style="color:#111"&gt;[{&lt;/span&gt;&lt;span style="color:#d88200"&gt;:role&lt;/span&gt; &lt;span style="color:#d88200"&gt;&amp;#34;user&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#d88200"&gt;:content&lt;/span&gt; &lt;span style="color:#d88200"&gt;&amp;#34;Fix: (println \&amp;#34;hello&amp;#34;&lt;/span&gt;&lt;span style="color:#111"&gt;}]}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#111"&gt;credentials&lt;/span&gt;&lt;span style="color:#111"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Notice:&lt;/strong&gt; This is not an official OpenAI project nor is it affiliated with
OpenAI in any way.&lt;/p&gt;
&lt;p&gt;Refer to the &lt;a href="https://github.com/pmatiello/openai-api"&gt;project page&lt;/a&gt;
and &lt;a href="https://cljdoc.org/d/me.pmatiello/openai-api/"&gt;documentation&lt;/a&gt; for more.&lt;/p&gt;</description></item><item><title>Announcing mockfn</title><link>https://www.pmatiello.me/posts/2018-03-22-announcing-mockfn/</link><pubDate>Thu, 22 Mar 2018 19:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2018-03-22-announcing-mockfn/</guid><description>&lt;p&gt;&lt;a href="https://github.com/pmatiello/mockfn"&gt;&lt;code&gt;me.pmatiello/mockfn&lt;/code&gt;&lt;/a&gt; is a library
supporting mockist test-driven-development in Clojure. It is meant to be used
alongside a regular testing framework such as &lt;code&gt;clojure.test&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It provides two macros to be used in tests. The first, &lt;code&gt;providing&lt;/code&gt;, replaces a
function with a configured mock.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-clj" data-lang="clj"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;testing&lt;/span&gt; &lt;span style="color:#d88200"&gt;&amp;#34;providing&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;providing&lt;/span&gt; &lt;span style="color:#111"&gt;[(&lt;/span&gt;&lt;span style="color:#75af00"&gt;one-fn&lt;/span&gt;&lt;span style="color:#111"&gt;)&lt;/span&gt; &lt;span style="color:#d88200"&gt;:result&lt;/span&gt;&lt;span style="color:#111"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;is&lt;/span&gt; &lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#111"&gt;= &lt;/span&gt;&lt;span style="color:#d88200"&gt;:result&lt;/span&gt; &lt;span style="color:#111"&gt;(&lt;/span&gt;&lt;span style="color:#75af00"&gt;one-fn&lt;/span&gt;&lt;span style="color:#111"&gt;)))))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second macro, &lt;code&gt;verifying&lt;/code&gt;, works similarly, but also defines an expectation
for the number of times a call should be performed during the test.&lt;/p&gt;</description></item><item><title>Injecting Akka Routers as Dependencies in a Play Application</title><link>https://www.pmatiello.me/posts/2015-07-19-injecting-akka-routers-as-dependencies-in-a-play-application/</link><pubDate>Sun, 19 Jul 2015 18:30:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2015-07-19-injecting-akka-routers-as-dependencies-in-a-play-application/</guid><description>&lt;p&gt;Sometimes, an actor can&amp;rsquo;t keep up with the amount of messages it receives. When
work is produced at a faster rate than it can be consumed, the system is in
trouble. A bounded mailbox will drop messages that were intended to the actor
while an unbounded one will grow until it consumes all the available memory and
crashes the application.&lt;/p&gt;
&lt;p&gt;If the task being performed isn&amp;rsquo;t CPU-bound or if there are enough cores
available in the machine, a simple solution might be just have enough instances
of this stressed actor working in parallel. &lt;a href="http://akka.io"&gt;Akka&lt;/a&gt; helps us to
implement this by
providing &lt;a href="http://doc.akka.io/docs/akka/snapshot/scala/routing.html"&gt;routers&lt;/a&gt;:
actors that
proxy, &lt;a href="http://doc.akka.io/docs/akka/snapshot/scala/routing.html#Supervision"&gt;supervise&lt;/a&gt;
and delegate messages to the child actors it manages. That is, when a mensage is
sent the the router, it will be forwarded to one of the managed actors so that
it can be properly handled. For the producer originating the messages, nothing
changes: it just needs an &lt;code&gt;ActorRef&lt;/code&gt; to the router and it can be completely
ignorant about the size of the pool of consumers and whether it is pushing work
directly to the consumer or through an intermediate.&lt;/p&gt;</description></item><item><title>Request-Scoped Dependency-Injection in Play Framework with MacWire</title><link>https://www.pmatiello.me/posts/2015-03-03-request-scoped-dependency-injection-in-play-framework-with-macwire/</link><pubDate>Tue, 03 Mar 2015 09:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2015-03-03-request-scoped-dependency-injection-in-play-framework-with-macwire/</guid><description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update (09 Jul 2015):&lt;/strong&gt; This post was written for Play 2.3.x.
Since &lt;a href="https://playframework.com/documentation/2.4.x/Highlights24"&gt;version 2.4.0&lt;/a&gt;, &lt;a href="https://playframework.com/documentation/2.4.x/ScalaDependencyInjection"&gt;dependency injection&lt;/a&gt;
is supported out of the box in Play
through &lt;a href="https://github.com/google/guice"&gt;Guice&lt;/a&gt;. Also, changes in routing at
this version of the framework break the approach described here.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Controllers in &lt;a href="https://www.playframework.com"&gt;Play Framework&lt;/a&gt; are usually
defined as singleton objects. In fact, Play&amp;rsquo;s documentation defines a controller
as &lt;a href="https://www.playframework.com/documentation/2.3.x/ScalaActions"&gt;a singleton object that generates Action values&lt;/a&gt;
and provides an example like the one below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#00a8c8"&gt;object&lt;/span&gt; &lt;span style="color:#75af00"&gt;Application&lt;/span&gt; &lt;span style="color:#00a8c8"&gt;extends&lt;/span&gt; &lt;span style="color:#75af00"&gt;Controller&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#00a8c8"&gt;def&lt;/span&gt; &lt;span style="color:#111"&gt;index&lt;/span&gt; &lt;span style="color:#00a8c8"&gt;=&lt;/span&gt; &lt;span style="color:#75af00"&gt;Action&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75af00"&gt;Ok&lt;/span&gt;&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#d88200"&gt;&amp;#34;It works!&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This kind of design is not without problems. Any dependencies of these
controllers must be constructed inside the controller, tightening the coupling
between them as the controller must now concern itself with one more aspect of
its dependencies, namely, their construction.&lt;/p&gt;</description></item><item><title>Database Isolation for Tests in Play Framework</title><link>https://www.pmatiello.me/posts/2015-01-03-database-isolation-for-tests-in-play-framework/</link><pubDate>Sat, 03 Jan 2015 19:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2015-01-03-database-isolation-for-tests-in-play-framework/</guid><description>&lt;p&gt;&lt;a href="https://www.playframework.com"&gt;Play Framework&lt;/a&gt; provides decent support for unit
and functional tests. Tests using the &lt;code&gt;WithApplication&lt;/code&gt;, &lt;code&gt;WithServer&lt;/code&gt; or the
&lt;code&gt;WithBrowser&lt;/code&gt; abstract classes will bootstrap your application so that
configurations are loaded and databases connections are available. Yet, nothing
is provided out of the box to ensure that database changes made during the
execution of a test will not leak into other tests or into the development
environment.&lt;/p&gt;
&lt;h2 id="about-play-slick-and-specs2"&gt;About Play, Slick and specs2&lt;/h2&gt;
&lt;p&gt;Here, we&amp;rsquo;ll be using &lt;a href="http://slick.typesafe.com"&gt;Slick&lt;/a&gt; for persistence
and &lt;a href="http://etorreborre.github.io/specs2/"&gt;specs2&lt;/a&gt; as testing framework, but the
general idea should apply to different libraries without any major changes. The
use of these libraries with Play is outside the scope of this post, but these
links should do a good job at introducing the subject:&lt;/p&gt;</description></item><item><title>Using a different configuration file when running tests in a Play project</title><link>https://www.pmatiello.me/posts/2014-12-26-using-a-different-configuration-file-when-running-tests-in-a-play-project/</link><pubDate>Fri, 26 Dec 2014 11:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2014-12-26-using-a-different-configuration-file-when-running-tests-in-a-play-project/</guid><description>&lt;p&gt;&lt;a href="https://www.playframework.com"&gt;Play Framework&lt;/a&gt;, as of version 2.3.x, typically
loads the configuration for your application from &lt;code&gt;conf/application.conf&lt;/code&gt;.
Although it works as expected, it doesn&amp;rsquo;t allow for different configurations to
be used in different environments unless the file is replaced. This is specially
inconvenient when running tests directly
from &lt;a href="https://typesafe.com/community/core-tools/activator-and-sbt"&gt;Activator&lt;/a&gt;
since these tests will be executed against the same database used for running
the application in development mode.&lt;/p&gt;
&lt;p&gt;Luckily, &lt;a href="https://github.com/typesafehub/config"&gt;Typesafe Config&lt;/a&gt;
and &lt;a href="https://typesafe.com/community/core-tools/activator-and-sbt"&gt;SBT&lt;/a&gt; provide
all that is necessary to work around this issue cleanly.&lt;/p&gt;</description></item><item><title>Futures in Scala</title><link>https://www.pmatiello.me/posts/2013-10-28-futures-in-scala/</link><pubDate>Mon, 28 Oct 2013 21:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2013-10-28-futures-in-scala/</guid><description>&lt;p&gt;Scala 2.10
introduced &lt;a href="http://docs.scala-lang.org/overviews/core/futures.html"&gt;futures&lt;/a&gt; as
a convenient abstraction for concurrent programming. Using futures, one can
perform a number of computations in parallel for which the result is expected to
be available, at some point, in these &lt;code&gt;Future&lt;/code&gt; objects.&lt;/p&gt;
&lt;p&gt;A result in a &lt;code&gt;Future&lt;/code&gt; can be easily retrieved without blocking the execution
flow by setting a callback to be invoked once it&amp;rsquo;s ready:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#00a8c8"&gt;val&lt;/span&gt; &lt;span style="color:#111"&gt;fut&lt;/span&gt; &lt;span style="color:#00a8c8"&gt;=&lt;/span&gt; &lt;span style="color:#111"&gt;future&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt; &lt;span style="color:#111"&gt;slowComputation&lt;/span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#111"&gt;fut&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#111"&gt;onSuccess&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#00a8c8"&gt;case&lt;/span&gt; &lt;span style="color:#111"&gt;result&lt;/span&gt; &lt;span style="color:#00a8c8"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#111"&gt;useSuccess&lt;/span&gt;&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#111"&gt;result&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This callback is guaranteed to be executed after the future completes
successfully. It&amp;rsquo;s also possible request a callback to be executed if the future
fails with an exception:&lt;/p&gt;</description></item><item><title>A few tricks for writing faster Ruby code</title><link>https://www.pmatiello.me/posts/2013-07-09-a-few-tricks-for-writing-faster-ruby-code/</link><pubDate>Tue, 09 Jul 2013 12:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2013-07-09-a-few-tricks-for-writing-faster-ruby-code/</guid><description>&lt;p&gt;Recently, I was busy at &lt;a href="http://www.baby.com.br"&gt;work&lt;/a&gt; trying to make some Ruby
code we&amp;rsquo;ve had written run faster. This is somewhat outside my zone of confort:
I&amp;rsquo;m mostly concerned about design, correctness, testability, etc, and most of
the time, my concerns about performance are restricted to proper choice of
algorithms, data structures and caching strategies. Although I&amp;rsquo;ve done my share
of profiling and performance improvements on Java applications, this was my
first time doing something like that in Ruby. And as I haven&amp;rsquo;t found much on
this subject on Google, I decided to share here some of the stuff that proved
themselves helpful to my problem.&lt;/p&gt;</description></item><item><title>A Kind of Informal Introduction to π-Calculus</title><link>https://www.pmatiello.me/posts/2013-01-06-a-kind-of-informal-introduction-to-pi-calculus/</link><pubDate>Sun, 06 Jan 2013 12:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2013-01-06-a-kind-of-informal-introduction-to-pi-calculus/</guid><description>&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/%CE%A0-calculus"&gt;π-Calculus&lt;/a&gt; is one of many
approaches to concurrent computation by the means of formal modeling. Its
purpose is to enable us to reason about concurrent processes in a disciplined
fashion by manipulating expressions through formally defined algebraic rules.&lt;/p&gt;
&lt;p&gt;Any exposition of the calculus will eventually introduce you to the primitive
notions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Agents&lt;/strong&gt;, which can be understood and even referred as processes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Actions&lt;/strong&gt;, which are anything that can be done by an agent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Channels&lt;/strong&gt;, which are links connecting agents, alowing them to communicate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Names&lt;/strong&gt;, which are exchanged through channels.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The general idea is that we have a set of agents connected to each other through
channels in some sort of network. These agents then use these channels
communicate to each other by exchanging names.&lt;/p&gt;</description></item><item><title>Implementing interface contracts in Python with class decorators</title><link>https://www.pmatiello.me/posts/2012-03-23-implementing-interface-contracts-in-python-with-class-decorators/</link><pubDate>Fri, 23 Mar 2012 12:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2012-03-23-implementing-interface-contracts-in-python-with-class-decorators/</guid><description>&lt;p&gt;Python decorators are quite useful and interesting. I&amp;rsquo;ve already written
about &lt;!-- raw HTML omitted --&gt;
function decorators&lt;!-- raw HTML omitted --&gt; in
a &lt;!-- raw HTML omitted --&gt;
previous post&lt;!-- raw HTML omitted --&gt; and &lt;!-- raw HTML omitted --&gt;class
decorators&lt;!-- raw HTML omitted --&gt; are a worthy followup.&lt;/p&gt;
&lt;p&gt;I order to illustrate this feature, we&amp;rsquo;ll implement support for interface
contracts for Python classes. In a language like Java, for instance, a contract
can be declared this way:&lt;/p&gt;</description></item><item><title>Dependency Injection in Ruby as inspired by Scala</title><link>https://www.pmatiello.me/posts/2011-03-15-dependency-injection-in-ruby-as-inspired-by-scala/</link><pubDate>Tue, 15 Mar 2011 12:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2011-03-15-dependency-injection-in-ruby-as-inspired-by-scala/</guid><description>&lt;p&gt;A
recent &lt;!-- raw HTML omitted --&gt;
discussion&lt;!-- raw HTML omitted --&gt; in
the &lt;!-- raw HTML omitted --&gt;GOOS&lt;!-- raw HTML omitted --&gt;&amp;rsquo; group
has lead me to consider different ways to compose objects in Ruby. Specifically,
as module inclusion seems to be the favored approach for adding stuff to classes
in Ruby, I&amp;rsquo;ve became interested in finding a more flexible idiom for this.&lt;/p&gt;
&lt;p&gt;The objective, therefore, is to define an instance variable in a module and be
able to have it injected in instances of some class. Since I&amp;rsquo;m not that familiar
with Ruby yet, I&amp;rsquo;m forced to turn to other languages for inspiration. A possible
solution in Scala, presented below, is kind of intuitive.&lt;/p&gt;</description></item><item><title>In which I give my own half-baked workaround to the lack of tail call optimization in Python</title><link>https://www.pmatiello.me/posts/2010-09-22-in-which-i-give-my-own-half-baked-workaround-to-the-lack-of-tail-call-optimization-in-python/</link><pubDate>Wed, 22 Sep 2010 12:00:00 +0000</pubDate><guid>https://www.pmatiello.me/posts/2010-09-22-in-which-i-give-my-own-half-baked-workaround-to-the-lack-of-tail-call-optimization-in-python/</guid><description>&lt;p&gt;A &lt;!-- raw HTML omitted --&gt;tail call&lt;!-- raw HTML omitted --&gt; is a function call such that
it is the last action performed by a procedure. Therefore, the value returned by
the caller procedure is the value returned by the called procedure. Many
compilers and interpreters take advantage of this situation by using the
caller&amp;rsquo;s stack space to execute the called procedure, instead of allocating more
space for it. Because no extra space is consumed by these calls, recursive tail
calls can be nested at will without risk of overflowing the stack.&lt;/p&gt;</description></item></channel></rss>