Recursion and while loops in Factor

October 11th, 2007 by Samuel Tardieu

Tonight, I was willing to create a while construct in Factor taking two items on the stack:

a quotation to execute when the test is true
a test quotation

For example, I wanted to be able to find the smallest power of two greater than or equal to an arbitrary number (here 34098) by doing:

1 [ 2 * […]

Why monads matter

March 6th, 2007 by Samuel Tardieu

Today, a friend of mine told me that he was writing a Sudoku solver in Haskell. I could not resist and also wrote a brute-force one. The code is ugly (I was trying to generate as short a program as possible), but it led me to interesting thoughts.
First, here is the code. Beware, you are […]

Non-classical paradigms and languages

February 23rd, 2007 by Samuel Tardieu

I may be the happiest computer-science teacher in the world: in less than three months, I will start teaching a whole new class called “non-classical paradigms and languages”. The goal is to let students pursuing their masters degree discover and manipulate concepts that they haven’t had a chance to play with when using mainstream languages […]

FizzBuzz and bored programmers

January 26th, 2007 by Samuel Tardieu

On his blog, tickletux advocates the use of FizzBuzz to find developers who grok coding. However, this kind of test may also cause difficulties. What do you do if a candidate answers with the following (correct) C code?
#include <stdio.h>
static const char *t[] = {”%d\n”, “Fizz\n”, “Buzz\n”, “FizzBuzz\n”};
int main()
{
unsigned int i;
for(i […]

Factor: a stack-based programming language

January 18th, 2007 by Samuel Tardieu

As you may already know, I’m a big fan of stack-based languages such as Forth, functional languages such as Haskell and reflexive languages such as Smalltalk. You can imagine how happy I was when I discovered Factor a few days ago: it combines all those aspects.
Today, a friend sent me someone email signature and asked […]

To peer review or to not peer review?

December 26th, 2006 by Samuel Tardieu

As an experienced programmer, I participate in many Free Software projects when time permits. I am committed to a few projects, and I frequently submit patches to random projects that I happen to bump into. I also understand the dynamics of free software: when a bug stands in my way, I often fix it myself […]

rforth1 optimizations

October 24th, 2006 by Samuel Tardieu

I worked a lot on rforth1 lately, a Forth compiler targetting the PIC 18f family of microcontrollers. I have added many new optimizations in order to generate smaller and more efficient code.
Let’s take an example. The Forth code below cycles through the 8 possible states of 3 leds connected to ports B5, B6 and B7 […]

Sometimes, I feel like a geek

August 28th, 2006 by Samuel Tardieu

When I laugh at this joke while I’ve seen it at least a dozen times already, I wonder if I’m not a little bit geeky.

ICFP Ada virtual machine

August 1st, 2006 by Samuel Tardieu

The ICFP contest of this year starts with the implementation of a virtual machine. While I didn’t participate to the contest itself, I wrote one in Python and rewrote another one in Ada for performance reasons. Here is its code, released in the public domain.

Mercurial: a field report

May 31st, 2006 by Samuel Tardieu

As a member of the Areabot association, I participated to the 2006 French robotics competition last week. We had to develop specific software for our robot, driven by two Shix boards containing each one a SH7750R processor at 240MHz running Linux and a Stratix EP1S25 FPGA.
We decided to use Mercurial from the beginning for our […]


Creative Commons License