Fantastic languages

and what to learn from them

Learn a language!

But why?


↔︎️ 🧠 ↔︎️

AI?


  • Unhelpful for niche languages
  • Still ↔︎️ 🧠 ↔︎️

∀ language

in increasing order of length

  • What?
  • Beard?
  • FizzBuzz?
  • Interesting?
  • Changed my thinking?

Beard 🧔 !?

viral in 2008:

Computer languages and facial hair 🔗

Jan Ouwens

EqualsVerifierjqno.nl

Java

- properties

Appeared in 1995
Used for Enterprise back-end, Android
Paradigm object-oriented
Typing strong, static
Runtime JVM

- creator

James Gosling

- creator

Beard: ✅

- what does it look like?

public class Program {
    public static void main(String...args) {
        for (int i = 1; i <= 100; i++) {
            if (i % 15 == 0) {
                System.out.println("FizzBuzz");
            }
            else if (i % 3 == 0) {
                System.out.println("Fizz");
            }
            else if (i % 5 == 0) {
                System.out.println("Buzz");
            }
            else {
                System.out.println(i);
            }
        }
    }
}

- what makes it interesting?

- how did it change my thinking?

BASIC

- properties

Appeared in 1964
Used for teaching
Paradigm imperative
Typing weak, static with sigils
Runtime interpreted

- creator

John Kemeny & Thomas Kurtz

- creator

Beard: ❌❌

- what does it look like?

10 FOR I = 1 to 100
20 LET S$ = ""
30 IF I % 3 = 0 THEN LET S$ = S$ + "FIZZ"
40 IF I % 5 = 0 THEN LET S$ = S$ + "BUZZ"
50 IF S$ = "" THEN LET S$ = I
60 PRINT S$
70 NEXT I

- what makes it interesting?

- how did it change my thinking?

from my master’s thesis

PHP

- properties

Appeared in 1995
Used for simple back-end
Paradigm imperative
Typing weak, dynamic
Runtime interpreted

- creator

Rasmus Lerdorf

- creator

Beard: ❌

- what does it look like?

<?php
for ($i = 1; $i <= 100; $i++)
{
    if (!($i % 15))
        echo "FizzBuzz\n";
    else if (!($i % 3))
        echo "Fizz\n";
    else if (!($i % 5))
        echo "Buzz\n";
    else
        echo "$i\n";
}
?>

- what makes it interesting?

- how did it change my thinking?

Elm

- properties

Appeared in 2012
Used for front-end
Paradigm functional
Typing strong, static
Runtime compiled to JavaScript

- creator

Evan Czaplicki

- creator

Beard: 🤷

- what does it look like?

import Html exposing (text)
import List exposing (map)

main =
  List.range 1 100 |> map getWordForNum |> String.join " "

getWordForNum num =
  if modBy num 15 == 0 then
    "FizzBuzz"
  else if modBy num 3 == 0 then
    "Fizz"
  else if modBy num 5 == 0 then
    "Buzz"
  else
    String.fromInt num

- what makes it interesting?

helloworld = "Hello world
I got to the end of the line without seeing the closing double quote:

6| helloworld = "Hello world
                             ^
Strings look like "this" with double quotes on each end. Is the closing double
quote missing in your code?

Note: For a string that spans multiple lines, you can use the multi-line string
syntax like this:

    """
    # Multi-line Strings

    - start with triple double quotes
    - write whatever you want
    - no need to escape newlines or double quotes
    - end with triple double quotes
    """

- how did it change my thinking?




<div>

Lisp

- properties

Appeared in 1958
Used for AI
Paradigm functional
Typing strong, dynamic
Runtime compiled to native

- creator

John McCarthy

- creator

Beard: ✅ ✅ ✅

- what does it look like?

(define (fizzbuzz x y)
  (cond ((eq? (remainder x 15) 0) (display "FizzBuzz\n"))
        ((eq? (remainder x 3) 0) (display "Fizz\n"))
        ((eq? (remainder x 5) 0) (display "Buzz\n"))
        (else (display x) (display "\n")))

  (cond ((< x y) (fizzbuzz (+ x 1) y))
        (else ())))

(fizzbuzz 1 100)

Scheme dialect

- what makes it interesting?

Minimal syntax, maximal power

(println "Hello world")

(+ 1 (* 2 3) 4)

(define Y
  (lambda (f)
    (f (lambda (x) ((Y f) x)))))

- how did it change my thinking?

Ruby

- properties

Appeared in 1995
Used for scripting, simple back-end
Paradigm object-oriented
Typing strong, duck
Runtime interpreted

- creator

Yukihiro Matsumoto

- creator

Beard: ✅

- what does it look like?

1.upto 100 do |i|
  puts "FizzBuzz" if i % 15 == 0
  puts "Fizz" if i % 3 == 0 and i % 5 != 0
  puts "Buzz" if i % 3 != 0 and i % 5 == 0
  puts i if i % 3 != 0 and i % 5 != 0
end

- what makes it interesting?

class Integer
  def to_xml
    "<int>#{self}</int>"
  end
end

puts 10.to_xml
class Module
  alias private_old private
  alias public_old public
  alias private public_old
  alias public private_old
end

- how did it change my thinking?


in production!?

Delphi

- properties

Appeared in 1995
Used for Windows GUIs
Paradigm object-oriented
Typing strong, static
Runtime compiled to native

- creator

Anders Hejlsberg

- creator

Beard: ❌

- what does it look like?

program FizzBuzz;
var
  i: Integer;
begin
  for i := 0 to 100 do
  begin
    if i mod 15 = 0 then
      WriteLn('FizzBuzz');
    else if i mod 3 = 0 then
      WriteLn('Fizz');
    else if i mod 5 = 0 then
      WriteLn('Buzz');
    else
      WriteLn(IntToStr(i));
  end;
end.

- what makes it interesting?

- how did it change my thinking?

C#

- properties

Appeared in 2000
Used for Windows GUIs, back-end
Paradigm object-oriented
Typing strong, static
Runtime .NET

- creator

Anders Hejlsberg

- creator

Beard: ❌

- what does it look like?

using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; i <= 100; i++)
        {
            if (i % 15 == 0)
            {
                Console.WriteLine("FizzBuzz");
            }
            else if (i % 3 == 0)
            {
                Console.WriteLine("Fizz");
            }
            else if (i % 5 == 0)
            {
                Console.WriteLine("Buzz");
            }
            else
            {
                Console.WriteLine(i);
            }
        }
    }
}

- what makes it interesting?

LINQ

var popular = from lang in languages
              where lang.Creator.HasBeard
              select lang.Name;

- how did it change my thinking?

TypeScript

- properties

Appeared in 2012
Used for front-end
Paradigm object-oriented
Typing gradual, structural
Runtime compiled to JavaScript

- creator

Anders Hejlsberg

- creator

Beard: ❌

- what does it look like?

for (let i = 1; i < 101; i++) {
    if (i % 15 === 0) {
        console.log('FizzBuzz')
    }
    else if (i % 3 === 0) {
        console.log('Fizz')
    }
    else if (i % 5 === 0) {
        console.log('Buzz')
    }
    else {
        console.log(i)
    }
}

- what does it look like?

for (let i: number = 1; i < 101; i++) {
    if (i % 15 === 0) {
        console.log('FizzBuzz')
    }
    else if (i % 3 === 0) {
        console.log('Fizz')
    }
    else if (i % 5 === 0) {
        console.log('Buzz')
    }
    else {
        console.log(i)
    }
}

- what makes it interesting?

// Lodash's pick() function

function pick(object, paths)

pick({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd'])
===> { a: 1, d:4 }



- what makes it interesting?

// Lodash's pick() function

function pick(object, paths)

pick({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd'])
===> { a: 1, d:4 }

function pick<O extends object, Keys extends keyof O>
             (object: O, paths: Keys[]): { [K in Keys]: O[K] }

- how did it change my thinking?

- how did it change my thinking?

AnnotationScript

- properties

Appeared in 2021
Used for fun
Paradigm functional
Typing weak, dynamic
Runtime Java annotations 🤯

- creator

Me!

- creator

Beard: ✅

- what does it look like?

import nl.jqno.annotationscript.AnnotationScript;
import nl.jqno.annotationscript.Annotations.*;

@Zero("begin")
@Zero(list={@One("define"), @One("fizz-buzz"), @One(list={@Two("lambda"), @Two(list=@Three("n")), @Two(list={
    @Three("cond"),
    @Three(list={@Four("="), @Four(list={@Five("%"), @Five("n"), @Five("15")}), @Four("0")}), @Three("'fizzbuzz'"),
    @Three(list={@Four("="), @Four(list={@Five("%"), @Five("n"), @Five("3")}), @Four("0")}), @Three("'fizz'"),
    @Three(list={@Four("="), @Four(list={@Five("%"), @Five("n"), @Five("5")}), @Four("0")}), @Three("'buzz'"),
    @Three("else"), @Three("n")})})})
@Zero(list={@One("map"), @One("println"), @One(list={@Two("map"), @Two("fizz-buzz"), @Two(list={@Three("range"), @Three("1"), @Three("101")})})})
public class FizzBuzz {
    public static void main(String[] args) {
        AnnotationScript.run(FizzBuzz.class);
    }
}

- what makes it interesting?

@Autowired @Bean
@Column(name = "id")
@PostMapping("/endpoint/new")
@Test
public void waitwhat() { ... }

- how did it change my thinking?

(begin
  (define fizz-buzz (lambda (n) (cond
    (= (% n 15) 0) 'fizzbuzz
    (= (% n 3) 0) 'fizz
    (= (% n 5) 0) 'buzz
    else n)))
  (map println (map fizz-buzz (range 1 101))))

Why didn’t you talk about

Assembler Kotlin
C Lua
C++ Python
Clojure Rust
Erlang Scala
Go Turbo Pascal
JavaScript VimScript

Wishlist


  • Gleam
  • OCaml

FIN

jqno.nl/talks/fantasticlanguages

image credits: see website