-
Notifications
You must be signed in to change notification settings - Fork 0
Home
FaJa id fully object oriented and dynamically typed programming language.
Every class start with keyword class and ends with endClass. Object is singleton class => there is only one instance. Class or Object can extend another class using extends keyword. Class can contains fields and methods. Fields definition starts with fields keyword. Fields can be separated by comma or new line. Fields section ends with endFields keyword. Methods starts with methods and ends with endMethods keyword. One line comments starts with :-)
Each method starts with def keyword and ends with end keyword. After def follow method name and in branches there are arguments separated by comma. Local variables are defined using keyword var. This class fields or methods can be access using keyword self:. Method call is performed by comma. You can also assign come method result or literal or another variable to some variable using <- operator.
Closure body start with { and ends with }. After start bracket can be comma separated arguments list. Arguments block ends with |. Closure body can be same as method body.
String literal is everything between " and ".
Number literal is only number.
Null literal is null.
Bool literals are true and false.
Array literal is [].
Method | Return value | Description |
---|---|---|
==(Object a) | Bool | Return true if this reference is equal to _a_ reference. |
toS() | String | Return String representation of object. |
isNull() | Bool | Return true. |
extends Object |
||
==(Object a) | Bool | Return true if all characters of _this_ and _a_ are equal. |
length() | Number | Length of String. |
+(Object a) | String | Concatenate String with String representation of object _a_. |
ifTrue(Closure a) | String | Call closure _a_ if string is not empty. Return String. |
ifFalse(Closure a) | String | Call closure _a_ if string is empty. Return String. |
toS() | String | Return self. |
toNumber() | Number | Try parse String to Number. If string is not number, throw exception. |
split(String a) | Array | Split String into Array of Strings using _a_ as delimiter. |
extends Object |
||
writeToFile(String a, Object b) | String | Append string representation of _b_ to file with path _a_ |
readFromFile(String a) | Array | Return array of Strings. Each String represents line of file with name _a_ |
out(Object a) | String | Print String _a_ to stdOut and return them. |
inString() | String | Read String from stdIn and return them. |
inNumber() | Number | Read Number from stdIn and return them. |
inBool() | Bool | Read Bool from stdIn and return them. |
extends Object |
||
==(Number a) | Bool | Return true if this is equal to _a_. |
+(Number a) | Number | Return this + _a_. |
-(Number a) | Number | Return this + _a_. |
*(Number a) | Number | Return this * _a_. |
/(Number a) | Number | Return this / _a_. |
%(Number a) | Number | Return this % _a_. |
ifTrue(Closure a) | Number | Call closure _a_ if number is not 0\. Return Number. |
ifFalse(Closure a) | Number | Call closure _a_ if number is 0\. Return Number. |
toS() | String | Return String representation of Number. |
times(Closure a) | Number | Call closure _a_ number times. Return Number. |
<(Number a) | Bool | Return true if this is less then _a_. |
>(Number a) | Bool | Return true if this is greater then _a_. |
<=(Number a) | Bool | Return true if this is less or equal then _a_. |
>=(Number a) | Bool | Return true if this is greater or equal then _a_. |
abs() | Number | Return absolute value of number. |
extends Object |
||
isNull() | Bool | Return true. |
ifTrue(Closure a) | Null | Never call Closure _a_. Return Null. |
ifFalse(Closure a) | Null | Call Closure _a_. Return Null. |
==(Object a) | Bool | Return true if _a_ is Null. |
toS() | String | Return string representation of Null. |
extends Object |
||
call() | Closure | Call closure code. |
extends Object |
||
==(Bool a) | Bool | Return true if this object is equal to _a_. |
ifTrue(Closure a) | Bool | Call Closure _a_ if this is true. Return Bool. |
ifFalse(Closure a) | Bool | Call Closure _a_ if this is false. Return Bool. |
and(Bool a) | Bool | Return true if this and _a_ are true. |
or(Bool a) | Bool | Return true if this or _a_ are true. |
not() | Bool | Return negation of Bool. |
toS() | String | Return string representation of Bool. |
extends Object |
||
toS() | String | Return string representation of Array. |
ifTrue(Closure a) | Array | Call Closure _a_ if array is not empty. Return Array. |
ifFalse(Closure a) | Array | Call Closure _a_ if array is empty. Return Array. |
each(Closure a) | Array | Call Closure _a_ for each item in array and return array. |
collect(Closure a) | Array | Call Closure _a_ for each item in array and return new array with item returned from closure _a_ |
add(Object a) | Array | Add Object _a_ to next empty position. |
add(Number a, Object b) | Array | Add Object _b_ to position _a_. |
get(Number a) | Object | Get Object from position _a_. |
push(Object a) | Array | Add Object _a_ to next empty position. |
pop() | Object | Return and remove Object from last position. |
top() | Object | Return Object from last position. |
size() | Number | Return size of not null items in array. |
contains(Object a) | Bool | Return true if array contains Object _a_. |
select(Closure a) | Array | Return array with items for which Closure _a_ returns true. |
extends Object |
||
run(Closure a) | Thread | Run closure _a_ in new thread. |
wait() | Thread | Waits for this thread to die. |