Introduction · July 30, 2026

Intro to Range

From the graph down to one point

#graph

Everything is a graph. Code is one look into it.

The world is made of things and the relationships between them. It is a vast space, where context keeps shifting, gradually, in the understanding of whoever is looking. Every program you have ever written was a piece of that space, drawn in a language that kept the lines out of sight.

IdentityValue

The two ends can be laid out apart, here and there, copied or shared. That is where control comes from. But the meaning never splits.

Nodes come in three forms. Construct gathers values, enum chooses between them, function moves between them.

3 concrete substrate forms

Inside a node, every member is one of four things. let is fixed. state can change. binding is someone else's. derived is worked out when asked.

Other languages choose once for the whole type. Range lets each member choose.

enum Direction {
case north
case east
case south
case west
}
construct Color {
let red: Float<bits: 32>
let green: Float<bits: 32>
let blue: Float<bits: 32>
let alpha: Float<bits: 32>(value: 1.0)
}
clamp(value: , low: , high: )
function clamp(value: Int, low: Int, high: Int): Int {
if low > high { diagnostic(message: "clamp: low is above high") }
if value < low { return low }
if value > high { return high }
return value
}
Thing {
...
}

A shape is only a name. Construct, enum, switch, all of them names for what we need to do. Under the names, one structure, hollow the way bone is hollow. Nothing fills it, and it holds.

Direction {
north
east
south
west
}
Color {
let red: Float<bits: 32>
let green: Float<bits: 32>
let blue: Float<bits: 32>
let alpha: Float<bits: 32>(value: 1.0)
}
Math.clamp(value: , low: , high: )
clamp<T: @integer | @float> {
let value: T
let low: T
let high: T
low > high -> diagnostic(message: "clamp: low is above high")
value < low -> return low
value > high -> return high
return value
}

This is how you understand.

Code is one look into it. Write yours.

On a Mac with Apple silicon, for now, with Apple's command line tools (xcode-select --install).

  1. Get Range
    git clone --depth 1 -b development https://github.com/RangeLang/Range
    cd Range
  2. Build it, about ten seconds
    ./Language/Compiler/Tools/build-range ./range
  3. Write a program
    cat > Mandelbrot.range <<'END'
    // The Mandelbrot set, drawn in the terminal. Change a number and run it again.
    Picture {
        let width: 72
        let height: 28
        let centerX: -0.6
        let centerY: 0.0
        let zoom: 1.3
        let detail: 60
    }
    
    // The letter for a point: how many steps it took to fly away, of all it had.
    shade {
        let steps: Int
        let of: Int
        steps = of -> return " "
        steps > 20 -> return "@"
        steps > 10 -> return "#"
        steps > 6 -> return "*"
        steps > 3 -> return ":"
        return "."
    }
    
    @main {
        let picture: Picture()
        for row in 0..<picture.height {
            state line: ""
            for column in 0..<picture.width {
                let x: picture.centerX + (Float(column) / Float(picture.width) - 0.5) * 3.2 / picture.zoom
                let y: picture.centerY + (Float(row) / Float(picture.height) - 0.5) * 2.4 / picture.zoom
                state a: 0.0
                state b: 0.0
                state steps: 0
                for step in 0..<picture.detail {
                    a * a + b * b < 4.0 -> {
                        let next: a * a - b * b + x
                        b: 2.0 * a * b + y
                        a: next
                        steps: steps + 1
                    }
                }
                line: line + shade(steps: steps, of: picture.detail)
            }
            print(message: line)
        }
    }
    END
  4. Run it
    ./range run Mandelbrot.range
  5. It prints
    ...............................:::::::::::::::***###***:::::::::........
    .............................::::::::::::::::#####  ###*::::::::::......
    ..........................:::::::::::::::::***#@      #**::::::::::.....
    ........................:::::::::::::::*******#@     @#***::::::::::....
    ......................:::::::::::::*@@##**#@# @#@   @@ @# @*****@*:::...
    ...................:::::::::::::::**##   #@               @ ###@##*:::..
    ................:::::::::::::::::***##                          @*:::::.
    .............::::::::::::::::::**#@@#                          #***:::::
    .......:::::::::*#***************##@                            #**#::::
    ..::::::::::::::*####**@@*******##                                #@::::
    :::::::::::::::***## @#@ @@ @####@                                **::::
    :::::::::::::***###@          ##@                                 @*::::
    ::::::::::**#***##             @                                 @*:::::
    ::**::::*****#@ @@                                              #*::::::
                                                                 @#***::::::
    ::**::::*****#@ @@                                              #*::::::
    ::::::::::**#***##             @                                 @*:::::
    :::::::::::::***###@          ##@                                 @*::::
    :::::::::::::::***## @#@ @@ @####@                                **::::
    ..::::::::::::::*####**@@*******##                                #@::::
    .......:::::::::*#***************##@                            #**#::::
    .............::::::::::::::::::**#@@#                          #***:::::
    ................:::::::::::::::::***##                          @*:::::.
    ...................:::::::::::::::**##   #@               @ ###@##*:::..
    ......................:::::::::::::*@@##**#@# @#@   @@ @# @*****@*:::...
    ........................:::::::::::::::*******#@     @#***::::::::::....
    ..........................:::::::::::::::::***#@      #**::::::::::.....
    .............................::::::::::::::::#####  ###*::::::::::......
  6. Change it

    The buttons only change three numbers in the program above: zoom: 1.3, centerX: -0.6 and centerY: 0.0. Copy it again and it prints this picture.