<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Fernando Meyer</title>
 <link href="http://fernandomeyer.com/atom.xml" rel="self"/>
 <link href="http://fernandomeyer.com/"/>
 <updated>2014-01-16T07:31:03-02:00</updated>
 <id>http://fernandomeyer.com</id>
 <author>
   <name></name>
 </author>
 
 
 <entry>
   <title>My Setup</title>
   <link href="http://fernandomeyer.com/posts/my-setup.html"/>
   <updated>2012-04-24T00:00:00-03:00</updated>
   <id>http://fernandomeyer.com/posts/my-setup</id>
   <content type="html">&lt;p&gt;Existe um interesse continuo e e quase instintivo em saber o que uma pessoa usa, como ela desenvolve seu trabalho e quais são seus truques e dicas. A serie play-by-play do &lt;a href=&quot;http://bit.ly/J2Jppq&quot;&gt;peepcode&lt;/a&gt; aborda um pouco como são as coisas por trás da tela para alguns desenvolvedores. Seguindo uma linha parecida o &lt;a href=&quot;http://bit.ly/HVpcRe&quot;&gt;usesthis.com&lt;/a&gt; possui uma proposta muito interessante, onde desenvolvedores, designers, artistas e músicos vem expondo suas preferencias na hora do &lt;a href=&quot;http://amzn.to/InD9F7&quot;&gt;&lt;em&gt;get things done&lt;/em&gt;&lt;/a&gt;. Vale a pena conferir.&lt;/p&gt;

&lt;p&gt;Seguindo essa linha, deixo aqui minha contribuição para esse voyerismo tecnológico.&lt;/p&gt;

&lt;h3 id=&quot;qual-o-hardware-que-voc-utiliza&quot;&gt;Qual o hardware que você utiliza?&lt;/h3&gt;

&lt;p&gt;Como a maioria das pessoas que conheço, faço uso de vários dispositivos da Apple. Tive todos os iPhones, utilizo Mac desde 2007 e comprei um iPad na primeira geração(ainda avalio se realmente preciso de um iPad). Hoje tento focar todas as minhas leituras no kindle, utilizo alguns scripts para enviar meus bookmarks direto pra ele, e aproveito para ler durante o trajeto para o trabalho.&lt;/p&gt;

&lt;p&gt;Comprei meu notebook atual, um MacBookPro6,2 i7 com 8G de ram, quando estava comprando fiz questão de uma tela &lt;em&gt;matte&lt;/em&gt; pois até hoje não me adaptei com o Glossy – o &lt;em&gt;matte&lt;/em&gt; seria a única coisa que eu sentiria falta hoje se eu migrasse para um &lt;em&gt;MB Air&lt;/em&gt;. Logo após adquirir o MBP fiz upgrade com um &lt;a href=&quot;http://amzn.to/J7zLgN&quot;&gt;SSD Vertex 2&lt;/a&gt; de 128MB, que veio a falecer recentemente, e me deixou as voltas com o péssimo serviço de RMA da OCZ. Hoje recomendo comprar hardware da &lt;a href=&quot;http://www.corsair.com/&quot;&gt;Corsair&lt;/a&gt; pois eles possuem suporte no Brasil e não enrolam para fazer RMA.&lt;/p&gt;

&lt;p&gt;Em 2006 eu &lt;em&gt;aderi a mobilidade&lt;/em&gt;, e aposentei o desktop que me acompanhava desde a época da faculdade e comprei um notebook, se é que eu poderia chama-lo de notebook pois era um toshiba de 17” que deveria pesar uns 8Kg com o carregador. Depois de 6 anos utilizando apenas o notebook, me senti novamente tentado a ter uma maquina potente para as mais genéricas atividades. A motivação veio &lt;a href=&quot;http://bit.ly/J5Ynca&quot;&gt;após anos de espera do openGL4&lt;/a&gt; nos &lt;strong&gt;MBP&lt;/strong&gt;&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, a possibilidade de brincar com &lt;a href=&quot;http://bit.ly/InD9F1&quot;&gt;geometry shaders&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/I7UT8i&quot;&gt;tessellation&lt;/a&gt; e &lt;a href=&quot;http://bit.ly/HVZQUP&quot;&gt;OpenCL&lt;/a&gt; me levou a busca de um hardware que coubesse no meu orçamento. Após adquirir todas as peças pude novamente apreciar a experiência de todo o &lt;em&gt;Do It Yourself&lt;/em&gt;, e bem diferente dos primeiros desktops que montei, tudo funcionou na primeira tentativa. &lt;/p&gt;

&lt;p&gt;No fim a configuração ficou assim: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://amzn.to/J7rRUE&quot;&gt;Processador Intel core I7-2600k&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://amzn.to/JdyYyH&quot;&gt;8GB de RAM Corsair Vengeance&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://amzn.to/I0n87J&quot;&gt;Placa mãe ASUS P8P67-PRO&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://amzn.to/JdyYyF&quot;&gt;VGA XFX ATI RADEON HD6870&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://amzn.to/J5RuaN&quot;&gt;Corsair Cooling Hydro-Series h60&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://amzn.to/JgdJaE&quot;&gt;PSU Corsair GS600&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eu escolhi ATI ao invés de NVidia pois esta possuía 2 saídas display port que funcionam sem problemas com o meu &lt;a href=&quot;http://amzn.to/I6sWdD&quot;&gt;&lt;em&gt;Apple Cinema Display 27&lt;/em&gt;&lt;/a&gt;. O gabinete é um caso a parte, quando vi o &lt;a href=&quot;http://amzn.to/I7SXgb&quot;&gt;Corsair 600T&lt;/a&gt; neste &lt;a href=&quot;http://www.codinghorror.com/blog/2011/07/building-a-pc-part-vii-rebooting.html&quot;&gt;post do Jeff Atwood&lt;/a&gt; eu achei que ele tinha tudo a ver com a máquina que eu queria e depois de muito pesquisar consegui comprar ele aqui no brasil. &lt;/p&gt;

&lt;p&gt;Se você tem mais de 20 anos talvez tenha conhecido os teclados &lt;a href=&quot;http://bit.ly/HUklNK&quot;&gt;IBM Model M&lt;/a&gt;, aqueles extremamente barulhentos mas estupidamente confortáveis. Hoje em dia é praticamente impossível achar um pra vender em bom estado, mas depois de discutir algumas vezes com o &lt;a href=&quot;http://zed.9hells.org/&quot;&gt;Zed&lt;/a&gt; sobre o assunto descobrimos a Unicomp, foram eles que compraram a patente do teclado e continuaram fabricando até hoje. No fim acabei comprando um &lt;a href=&quot;http://bit.ly/HOKJqf&quot;&gt;SpaceSaver M&lt;/a&gt; que é uma versão &lt;em&gt;light&lt;/em&gt; do original &lt;/p&gt;

&lt;h3 id=&quot;e-qual-software&quot;&gt;E qual software?&lt;/h3&gt;

&lt;p&gt;Eu já perdi todos os dados da minha vida quando tive um notebook roubado, hoje faço backups diariamente para a Amazon S3 e um disco físico, assim não corro o risco de perder nada novamente. &lt;/p&gt;

&lt;p&gt;Eu ainda escrevo bastante, ando sempre com um moleskine para tomar notas das coisas importantes, se isso for extremamente importante tiro uma foto e envio para o Evernote. Consigo driblar minha dislexia e escrever textos longos utilizando AI Writer e estou me reeducando a controlar minhas listas no &lt;a href=&quot;http://www.wunderlist.com/&quot;&gt;wunderlist&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Nas minhas pesquisas não consigo abandonar o &lt;a href=&quot;http://bit.ly/JdADnQ&quot;&gt;Skim&lt;/a&gt; e &lt;a href=&quot;http://bit.ly/Inzl6Q&quot;&gt;Papers2&lt;/a&gt; com eles consigo controlar uma quantidade enorme de PDFs e tomar nota no próprio arquivo, o que facilita muito as coisas. &lt;/p&gt;

&lt;p&gt;Como estou trabalhando com muitos dados e algoritmos diferentes, utilizo uma gama enorme de utilitários, entre eles estão o &lt;a href=&quot;http://bit.ly/HOKJqh&quot;&gt;Rstudio&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/J2ErsS&quot;&gt;SequelPro&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/J2EsNv&quot;&gt;Weka&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/HUapay&quot;&gt;Protegé&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/HUkpgD&quot;&gt;Gerphi&lt;/a&gt; e &lt;a href=&quot;http://bit.ly/I6r44s&quot;&gt;Excel&lt;/a&gt;. Para descrever meu &lt;em&gt;env&lt;/em&gt; de programação eu teria que utilizar mais um post completo, mas basicamente eu me viro com &lt;a href=&quot;http://bit.ly/J7ttO5&quot;&gt;zsh&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/HJu0Wv&quot;&gt;tmux&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/HUkmRT&quot;&gt;ack-grep&lt;/a&gt; e &lt;a href=&quot;http://bit.ly/HRpvNp&quot;&gt;VIM&lt;/a&gt;. &lt;/p&gt;

&lt;h3 id=&quot;com-us-1bi-na-mo-qual-seria-seu-ambiente&quot;&gt;Com US$ 1Bi na mão, qual seria seu ambiente?&lt;/h3&gt;

&lt;p&gt;Não acredito na máxima onde dizem que dinheiro não traz felicidade, hoje nos condicionamos ao trabalho como forma de sustento e são poucos que realmente gostam do que fazem. Dinheiro infinito seria uma fonte infinita de felicidade, mas por incrível que possa parecer hoje meu hardware reflete muito minhas necessidades, se eu possuísse uma grana dessas provavelmente iria precisar apenas de uma Barco e um bom estoque de vinho =)&lt;/p&gt;

&lt;hr /&gt;

&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;Se você conhece os &lt;em&gt;internals&lt;/em&gt; do &lt;strong&gt;OS X&lt;/strong&gt; saberá que o Quartz(&lt;em&gt;rendering engine&lt;/em&gt;) é totalmente baseada em openGL2.1, &lt;em&gt;Core Image&lt;/em&gt; e algumas extensões desenvolvidas pela própria Apple e se aventurar em atualizar isso, não deve ser uma tarefa nada agradável. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>The last question</title>
   <link href="http://fernandomeyer.com/posts/a-ultima-pergunta.html"/>
   <updated>2011-06-26T00:00:00-03:00</updated>
   <id>http://fernandomeyer.com/posts/a-ultima-pergunta</id>
   <content type="html">&lt;p&gt;Na minha opinião, tanto literatura quanto história, são as disciplinas que mais sofrem na mão dos professores durante os anos do ensino médio. Ficamos na maioria das vezes restritos a literatura portuguesa e história do Brazil, naturalmente causando náuseas e desdém da maioria dos estudantes.Quando paramos de estudar por obrigação e buscamos conhecimento por interesse descobrimos um mundo novo e cheio de vida que nos foi negado durante muito tempo. &lt;/p&gt;

&lt;p&gt;Foi assim comigo e com várias pessoas que conheci durante a vida. Machados, Alencares e Amados, do quinhentismo ao modernismo aos livros empoeirados da biblioteca Rocha Pombo, literatura era uma coisa chata.&lt;/p&gt;

&lt;p&gt;Com meu Kindle carregado de coisas boas, posso me dedicar à leitura casual e ir preenchendo as lacunas que foram deixadas abertas durante a vida. &lt;/p&gt;

&lt;p&gt;Lembro que um dos primeiros livros que li por conta própria foi a Fundação, uma leitura bem mais branda e com tema bem futurístico mesmo tendo sido escrita na forma de contos nos anos 40. No prefácio, Asimov descrevia como extraiu uma historia sobre o futuro a partir da analogia a queda do Império Romano. Nascia ali mais um interesse. &lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Pagerank isn't for humans</title>
   <link href="http://fernandomeyer.com/posts/pagerank-isnt-for-humans.html"/>
   <updated>2009-09-30T00:00:00-03:00</updated>
   <id>http://fernandomeyer.com/posts/pagerank-isnt-for-humans</id>
   <content type="html">&lt;p&gt;We’re setting between the transition from a web of links and a sequence of words to a web of content, meaning and knowledge. I believe this trend is the next moving that your generation is going to present.
A few weeks ago I was discussing with a friend how can we bring knowledge to the web, how can we use the web to make a really efficient human driven search engine. &lt;/p&gt;

&lt;p&gt;Every single research on NLP field has those kind of question sticked with their mind, “how can we improve search and content relational algorithms?”. I believe we can rely on common concepts we’ve being using since the beginning of the times. Trustiness, influence, authority when applied to the web can boost the research field into totally new direction. &lt;/p&gt;

&lt;p&gt;My propose is that page content can be delivered and explored  against the link/words algorithms with no explicit meaning and a simple assumption “yes … we know you’re a good reference because you have a lot of links”.&lt;/p&gt;

&lt;p&gt;I’d like to understand how do you ask a direction whenever you get lost?  You may ask a computer(google in this case): “Sunday night guitar red cap TV?” When you place this same question to a person in a totally different way, You should ask your close friend who share interests with you, what has the Sunday night TV show where a girl with a funny red cap was playing a guitar.  Things does change when you bring meaning to it, that’s what computers should archive. &lt;/p&gt;

&lt;p&gt;Indeed, Google is still leading this race with several fields under extreme research. Articles about Data Mining, Collective Intelligence and AI being published denotes this future trend coming from Mountain View.&lt;/p&gt;

&lt;p&gt;Maybe things are about to change.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Writing a DSL with Python</title>
   <link href="http://fernandomeyer.com/posts/writing-a-DSL-with-python.html"/>
   <updated>2009-09-05T00:00:00-03:00</updated>
   <id>http://fernandomeyer.com/posts/writing-a-DSL-with-python</id>
   <content type="html">&lt;p&gt;A domain-specific language is a piece of software designed to be useful for a specific task in a fixed problem domain, they’re gaining popularity because they enhance productivity and reusability of artifacts. DSLs also enable expression and validation of concepts at the level of abstraction of the problem domain, this approach is very useful when you need to describe a user interface, a business process, a database, or the flow of information.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;For added security, you can require a four-digit passcode to be entered any time the Dropbox mobile app is launched. This way, you’ll know your Dropbox is safe even if your smartphone or tablet falls into the wrong hands.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The DSL concept isn’t new after all, special-purpose programming languages and all kinds of modeling, specification languages have always existed, but this term rise due the popularity of domain-specific model.&lt;/p&gt;

&lt;p&gt;You can easily implement dsls using the ruby language, Java or even C# if you prefer, but this isn’t the main propose of this article. The sine qua non become visible when I was implementing a simple test case with python. Indeed, there are a lot of python BDD-like frameworks, mostly who are self claimed the silver bullet, that are mismatching a lot of basic principles, but like I said, we are talking about dsls =)&lt;/p&gt;

&lt;p&gt;With python we can easily create a piece of software that expresses some basic desired behavior, like rspec does, but much more pythonic.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;c&quot;&gt;# coding: pyspec&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;shot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;got shot&amp;quot;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Bowling&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;should score 0 for gutter game&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;bowling&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Bow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;bowling&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;that&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bowling&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;should_be&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;we can easily make this test dsl a runnable piece of python code, whiteout writing incompressible regular expressions, just using the python codecs and tokenizer.&lt;/p&gt;

&lt;p&gt;Fist of all we need to define a new encoding for pyspec – our pre defined spec file syntax – this neat hacking enables a new path to tokenize this file&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;tokenize&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;cStringIO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;encodings&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;encodings&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf_8&lt;/span&gt;
 
    &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf_8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kwargs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kwargs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;untokenize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;translate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;readline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cStringIO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StringIO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;search_function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;pyspec&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encodings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search_function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;utf8&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# Assume utf8 encoding&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CodecInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;pyspec&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;decode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;incrementalencoder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;incrementalencoder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;incrementaldecoder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;incrementaldecoder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;streamreader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;streamwriter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;streamwriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 
    &lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search_function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Our tiny translate function defines a easy way to translate both describe and it into a traditional python class and method definition.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;method_for_it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;(self)&amp;quot;&lt;/span&gt;
 
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;translate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;readline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;previous_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;generate_tokens&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;readline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tokenize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NAME&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;describe&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;class&amp;#39;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tokenize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NAME&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;it&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;def&amp;#39;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;previous_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;it&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;method_for_it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;previous_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Clever isn’t ? Now, fell yourself free to &lt;a href=&quot;http://github.com/fmeyer/pydsl/tree/master&quot; title=&quot;Github&quot;&gt;fork this project on GitHub&lt;/a&gt; and finish the job =) maybe someday we can have a real BDD python framework. &lt;/p&gt;

&lt;h3 id=&quot;references&quot;&gt;References:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://docs.python.org/library/codecs.html&quot; title=&quot;Codec&quot;&gt;Codec registry and base classes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://docs.python.org/library/tokenize.html&quot; title=&quot;Tokenize&quot;&gt;Tokenizer for Python source&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Alligator Eggs: The game</title>
   <link href="http://fernandomeyer.com/posts/alligators-eggs.html"/>
   <updated>2007-07-10T00:00:00-03:00</updated>
   <id>http://fernandomeyer.com/posts/alligators-eggs</id>
   <content type="html">&lt;p&gt;Reading my daily incoming links I faced with this interesting link &lt;a href=&quot;http://worrydream.com/AlligatorEggs/&quot;&gt;http://worrydream.com/AlligatorEggs/&lt;/a&gt; someone had a great idea about a nice puzzle, the alligator game.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://worrydream.com/AlligatorEggs/pieces_1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This game represents the &lt;strong&gt;untyped lambda calculus&lt;/strong&gt;. A &lt;strong&gt;hungry alligator&lt;/strong&gt; is a lambda abstraction, an &lt;strong&gt;old alligator&lt;/strong&gt; is parentheses, and &lt;strong&gt;eggs&lt;/strong&gt; are variables. The &lt;strong&gt;eating rule&lt;/strong&gt; corresponds to beta-reduction. The &lt;strong&gt;color rule&lt;/strong&gt; corresponds to (over-cautious) alpha-conversion. The &lt;strong&gt;old age rule&lt;/strong&gt; says that if a pair of parentheses contains a single term, the parentheses can be removed.  &lt;/p&gt;

&lt;h2 id=&quot;schematic-form&quot;&gt;Schematic Form&lt;/h2&gt;

&lt;p&gt;I’ve found that a schematic form of alligator calculus is actually rather handy for calculating lambda terms by hand. We draw a lambda as a line with a mouth. Parentheses are a line without a mouth. Here’s the identity function:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/AlligatorEggs/schematic_1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here are some Church numerals:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/AlligatorEggs/schematic_2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here are boolean AND and OR (assuming the standard definitions for TRUE and FALSE):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/AlligatorEggs/schematic_3.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The Y combinator:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/AlligatorEggs/schematic_4.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I don’t know if these are any easier to &lt;strong&gt;read&lt;/strong&gt; than the standard notation, but I’ve found them to be easier to &lt;strong&gt;work with&lt;/strong&gt;, using pencil and paper. I imagine the terms eating one another and hatching below. I don’t get lost in a long chain of symbols, losing track of what’s applying to what.&lt;/p&gt;

&lt;p&gt;I’m sure that after 4.0 &lt;a href=&quot;http://blog.athico.com&quot;&gt;drools&lt;/a&gt; release I’m going to implement this game as a drools DRL.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;**&lt;/em&gt; Unfortunately I didn’t wrote this while drooling with Mark, maybe someday I do it with a few scheme code.&lt;/p&gt;

</content>
 </entry>
 
 
</feed>