Slightly modified example of thesis: Figure 4.4, page 87

The colm language has evolved since it has been described in the thesis. With some modifications we can reactivate this example.

figure_44.lm

Please Note:

  • the syntax is very c-ish

  • the variables are defined with their type

  • there is no postfix increment operator (i = i +1)

That gives us:

hello 0 0
hello 1 1
hello 2 2
hello 8 3
hello 9 4

Real FizzBuzz

The fizzbuzz test is often used to check if someone has programming skills. It is the next logical step to hello world.

fizzbuzz.lm

It appears that there is no modulo operator (%). Therefor we’ll resort to a function. Writing a function seems rather straight forward.

Please note: * that && is working. * The return type is needed, but if nil is returned by default.

That gives us

FizzBuzz
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19