A friend of mine challenged me today to the number game. This is a classical one, where you have to guess a number between 0 and 999, and the computer will tell you whether you were right on or if you were above or below the chosen number.
Instead of doing dichotomy by hand or with [...]
Tagged with English, Forth, Free Software, Languages, Programming| 1 Comment »
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 * [...]
Tagged with English, Factor, Languages, Programming| 2 Comments »
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 [...]
Tagged with English, Haskell, Languages, Programming| 5 Comments »
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 [...]
Tagged with English, Free Software, Languages, Programming| 24 Comments »
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 [...]
Tagged with English, Programming| 6 Comments »
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 [...]
Tagged with English, Factor, Free Software, Linux, Programming| 9 Comments »
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 [...]
Tagged with Asterisk, English, Free Software, Linux, Programming, VoIP| 2 Comments »
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 [...]
Tagged with English, Forth, Free Software, Languages, Linux, Programming| 2 Comments »
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.
Tagged with English, Programming| 3 Comments »
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.
Tagged with Ada, English, Languages, Programming, Technology| 3 Comments »