Tagging


Operators

Matching

r : # x / y {
    .default {[value] value }
    .error {[error] `log error; 0 }
}

Asserting

If no tag is specified for an operation, .default is used

An invalid assertion produces an Error with an .error tag

r : x /.default y
r : x / y // same as above

Lambdas

If no tag is specified .default is used, user defined coroutines don't have to have a .default tag

Returning

add : `{[I64 x; I64 y] `return.default x + y }
add : `{[I64 x; I64 y] .default x + y } // same as above
add : `{[I64 x; I64 y] x + y } // same as above
mu : `{[Bool i]
    ? i {
        .int 1
    } {
        .float 1.1
    }
}

Matching

// using the mu corotuine from above
i : # mu `call `true {
    .int {[i] i }
    .float {[f] I64 f }
}

Asserting

// using the mu coroutine from aboce
i : mu `call.int `true

Generators

Generators use a .done tag to denote when it is complete

gen : ^{[I64 n]
    @ 1 .. n {[x]
        `yield x
        // above is alias for -> `yield.default x
    }
    // stopping is implicit, use `stop to explicitly end iterator
}

it : gen `init 10

Matching

v : # `next it {
    .default {[x] x }
    .done { -1 }
}

Asserting

v : `next.default it
v : `next it // same as above

Tables

Creating

table : Table (.a 1; .b 1.1)

Accessing

`log table.a

Loops

Break

@.outer condtion {
    @ condition {
        `break.outer
    }
}

Continue

@ (x : 0; x < 10; x +: 2) {
    ? x < 5 { `continue }
    ...
}