darcsden :: alex -> the -> blob

the programming language

root / prelude / block.the

(start: Integer) to: (end: Integer) by: (diff: Integer) do: b := {
    b call: [start]

    check =
        if: (diff < 0)
            then: { start + diff >= end }
            else: { start + diff <= end }

    when: check
        do: { (start + diff) to: end by: diff do: b }
} call

(start: Integer) up-to: (end: Integer) do: b :=
    start to: end by: 1 do: b

(start: Integer) down-to: (end: Integer) do: b :=
    start to: end by: -1 do: b

(n: Integer) times: (b: Block) :=
    1 up-to: n do: b in-scope

(b: Block) repeat := { b call; b repeat } call

(b: Block) in-scope :=
    Object clone do: {
        delegates-to: b
        call := b scope join: b
        call: vs := b scope join: b with: vs
    }

(a: Block) .. (b: Block) :=
    Block new: (a contents .. b contents)