|
Documentation
How Foom Works...
FoomFoom is a dynamically typed, lazily interpreted language. Most statement are terminated with a ; with the exception of for and if/else. For examples, please take a look at the tests directory in the source. DatatypesThere are five basic types in Foom:
VariablesVariables are declared with a primary data type as such: str s;
int i = 10;
list l = [2, i, 39];
func f;
f = { args[1]; };Currently, one declaration per statement. CommentsCurrently nonexistent. Planning on # to ignore rest of line. Maybe ## for blocks. FunctionsFunctions are declared using the func keyword, setting the variable to a block. The block is only evaluated when the function is called so using the function variable name in the block, thus a recursive function, will behave as expected. Arguments to the function are passed in as list called args. All variables are currently passed by reference. The last statement in a function is the function's return value. Functions are assignment statements thus must end with a ;. (Per Bug 1, all functions require arguments.) The following function takes three arguments: a list L, integer A, and integer B. It swaps position A in list L with position B and returns L at the end. func swap = {
list l = args[0];
int t = l[args[1]];
l[args[1]] = l[args[2]];
l[args[2]] = t;
l;
};LibrariesCurrently, only one library exists and it is imported automatically. syssys has two fuctions:
|