QC

Quite Concise Programming Language

Find out more!

Code sample

The idea is to create a simple (in terms of complexity, not ease of use) programming language, that will have quite a concise syntax, that will play with the power of Unicode and most importantly – will be fun to create ;)

The code below returns the Collatz sequence for a number (or an array of numbers) given as input:

(⪑☯1:{Aa⇓↓a1>:aa2%a3*1+a2/▲=}AS⥋)I☯

Corresponding PHP code is shown on the side. Obviously, it's much longer, however clearer and more readable. But where's the fun in that?

If you're looking for a more esoteric experience than the languages which are, well... useful... then QC is a way to go!

Interested?

function collatz($a) {
    if (!is_array($a)) {
        return doCollatz($a);
    }
    $output = [];
    foreach ($a as $num) {
        $output[] = doCollatz($num);
    }
    return $output;
}

function doCollatz($a) {
    $list = [];
    while (($list[] = $a) && $a > 1) {
        $a = $a % 2 ? 3 * $a + 1 : $a / 2;
    }
    return implode(' ', $list);
}

return collatz($input);