GEL stands for Genius Extension Language. Alternatively it also stands for George's Ego Leverage. It is the language you use to write programs in Genius. A program in GEL is simply an expression that evaluates to a number.
Values in GEL can be numbers, Booleans or strings. Values can be used in calculations, assigned to variables and returned from functions, among other uses.
Integers are the first type of number in GEL. Integers are written in the normal way.
1234Hexidecimal and octal numbers can be written using C notation. For example:
0x123ABC 01234Or you can type numbers in an arbitrary base using <base>\<number>. Digits higher than 10 use letters in a similar way to hexidecimal. For example, a number in base 23 could be written:
23\1234ABCD
The second type of GEL number is rationals. Rationals are simply achieved by dividing two integers. So one could write:
3/4to get three quarters. Rationals also accept mixed fraction notation. So in order to get one and three tenths you could write:
1 3/10
The next type if number is floating point. These are entered in a similar fashion to C notation. You can use E, e or @ as the exponent delimiter. Note that using the exponent delimiter gives a float even if there is no decimal point in the number. Examples:
1.315 7.887e77 7.887e-77 .3 0.3 77e5
The final type of number in gel is the complex numbers. You can enter a complex number as a sum of real and imaginary parts. The imaginary part ends with an i. Here are examples of entering complex numbers:
1+2i 8.01i 77*e^(1.3i)
When entering imaginary numbers, a number must be in front of the i. If you use i by itself, Genius will interpret this as referring to the variable i. If you need to refer to i by itself, use 1i instead. In order to use mixed fraction notation with imaginary numbers you must have the mixed fraction in parentheses. (i.e., (1 2/5)i) |
Genius also supports native Boolean values. The two Boolean constants are defined as true and false; these identifiers can be used like any other variable. You can also use the identifiers True, TRUE, False and FALSE as aliases for the above.
At any place where a Boolean expression is expected, you can use a Boolean value or any expression that produces either a number or a Boolean. If Genius needs to evaluate a number as a Boolean it will interpret 0 as false and any other number as true.
In addition, you can do arithmetic with Boolean values. For example:
( (1 + true) - false ) * trueis the same as:
( (true or true) or not false ) and trueOnly addition, subtraction and multiplication are supported. If you mix numbers with Booleans in an expression then the numbers are converted to Booleans as described above. This means that, for example:
1 == truealways evaluates to true since 1 will be converted to true before being compared to true.
Like numbers and Booleans, strings in GEL can be stored as values inside variables and passed to functions. You can also concatenate a string with another value using the plus operator. For example:
a=2+3;"The result is: "+awill create the string:
The result is: 5You can also use C-like escape sequences such as \n,\t,\b,\a and \r. To get a \ or " into the string you can quote it with a \. For example:
"Slash: \\ Quotes: \" Tabs: \t1\t2\t3"will make a string:
Slash: \ Quotes: " Tabs: 1 2 3
In addition, you can use the library function string to convert anything to a string. For example:
string(22)will return
"22"
Strings can also be compared with ==, != and <=> operators
Null is a special value. No operations can be performed on it, and nothing is printed when it is returned. Therefore, Null is useful when you do not want output from an expression. Null can be obtained as an expression when you type . or nothing.
Example:
x=5;. x=5;