omega

omega is a stack language and the shell of Subverge. Values are pushed onto the stack, and words take them off and push their results, so an expression is written with its operator last (yes, backwards, you'll get used to it). This page covers the values and the rules for names, and you can check Words to see which words omega provides.

Contents

Values

Type Written as
integer 42 -7 0x2a
string "text", with the escapes \n \t \e \\ \", where \w is omega and \A is aleph
quote [ 1 2 + ], which is code and a list at once
symbol 'name
ordinal omega epsilon0 omega1, kept in Cantor normal form
cardinal aleph0 aleph1 aleph continuum

A # starts a comment that runs to the end of the line (write comments, future you will be pissed otherwise).

Integers

Integers are 64-bit.

Quotes

A quote is both code and a list. [ 1 2 + ] can be run, mapped over, indexed or appended to, so omega has no separate array type and arrays and code are the same thing (it's quotes all the way down).

Ordinals and cardinals

Ordinals and cardinals are values like any other and take part in arithmetic and comparison. Check Ordinals and cardinals for how they work.

Names

You define a word by taking a quote from the stack and giving it a name.

[ dup * ] :sq         define a word from the stack
7 sq                  49

The words that manage names are get, forget, see, words, edit, defined?, >sym and src.

Lookup order

omega looks a name up in the locals first, then in the tab's own definitions, then in root, and finally in the built-in words (that's the whole lookup). A definition in a tab can therefore shadow a root word, and a root word can shadow a built-in one.

Locals

->x sets a local from the stack, and { a b } binds several locals at once, with the last name taking the value that was on top of the stack.

[ { a b } a b - ] :d

Locals are dynamically scoped (yes, on purpose, deal with it), so a word sees the locals of the word that called it. A callee that binds { n } hides the caller's n for the length of the call, and a callee that reads an n that it never bound gets the caller's.

->x with no local named x creates a global definition, so check your spelling.

Errors

A word that fails stops the line, and the line is rolled back, as World explains. If you want a line to carry on after a failure, use try, which is covered in Words.

Help

help lists every word by group. 'word help shows you the stack effect and an example for one word, and 'group help lists the words in a group. The groups are syntax, stack, math, logic, flow, lists, text, io, names, world, infinity, memory, ports, time, screen, machine, dev, tools, demos, games, util and helpers.

The build fails when a word has no help entry.

See also