table of contents
VOL-2(7) | AFNIX Users Manual | VOL-2(7) |
NAME¶
vol-2 - afnix reference manualRESERVED KEYWORDS¶
Reserved keyword are, with symbols and literals, the basic constituents of the writing system. With couple of exception, reserved keywords are in fact special forms. During the execution, a special assertassert "form 1" "form 2"
Example
assert true (== 1 1) assert 3 (+ 2 1)
block
block "regular form" block "block
form"
Example
trans a 1 block {
assert a 1
trans a (+ 1 1)
assert a 2
assert ..:a 1 } assert 1 a
class
assert a 1
trans a (+ 1 1)
assert a 2
assert ..:a 1 } assert 1 a
class
Example
const Color (class) trans Color:preset (red green blue) {
const this:red red
const this:green green
const this:blue blue } const red (Color 255 0 0) const green (Color 0 255 0) const blue (Color 0 0 255)
const
const this:red red
const this:green green
const this:blue blue } const red (Color 255 0 0) const green (Color 0 255 0) const blue (Color 0 0 255)
const symbol "object" const symbol
"argument" "body" const symbol "argument"
"closed variables" "body"
Example
const number 123 const max (x y) (if (> x y) x
y)
delay
delay "form"
Example
trans y 3 const l ((lambda (x) (+ x y)) 1) assert 4
(force l) trans y 0 assert 4 (force l) trans y 1 trans d (delay (lambda (x) (+
x 1)) y) assert 2 (force d)
do
do "body" "condition" do
"initial" "body" "condition"
Example
const number-of-digits (s) {
const len (s:length)
trans index 0
trans count 0
do {
trans c (s:get index)
if (c:digit-p) (count:++)
} (< (index:++) len)
eval count }
enum
const len (s:length)
trans index 0
trans count 0
do {
trans c (s:get index)
if (c:digit-p) (count:++)
} (< (index:++) len)
eval count }
enum "literal" ...
Example
const e (enum E1 E2 E3)
errorln
errorln errorln "nil" errorln "literal
list"
Example
errorln errorln "hello millennium" ' '
2000
eval
eval "object"
Example
const ret (x) (eval x) eval (protect (+ 1 2))
for
for "symbol list" "iterable object
list" "body"
Example
# compute the scalar product of two vectors const
scalar-product (u v) {
trans result 0
for (x y) (u v) (result:+= (* x y))
eval result }
force
trans result 0
for (x y) (u v) (result:+= (* x y))
eval result }
force "object"
Example
trans y 3 const l ((lambda (x) (+ x y)) 1) assert 4
(force l) trans y 0 assert 4 (force l)
if
if "condition" "true form" if
"condition" "true form" "else form"
Example
const max (x y) (if (> x y) x y)
lambda
lambda "nil" "body" lambda
"argument list" "body" lambda "argument list"
"closed variables list" "body"
Example
const no-args (lambda nil (+ 1 1)) const add (lambda
((const x) (const y)) (+ x y)) const closed (lambda (x) (y) (+ x y))
launch
launch "form" launch "thread"
"form"
Example
launch (println "hello world")
loop
loop "init form" "exit form"
"step" "form"
Example
loop (trans i 0) (< i 10) (i:++) (println i)
nameset
nameset nameset "parent nameset"
Example
const local-nameset-not-bound (nameset) const
local-nameset-bounded (nameset ...) const ...:global-nameset (nameset)
println
println println "nil" println "literal
list"
Example
println println "hello millennium" ' '
2000
protect
protect "object"
Example
const cons (protect (+ 1 2))
return
return "object"
Example
return (+ 1 2)
sync
sync "form"
Example
const print-message (code mesg) (
sync {
errorln "error : " code
errorln "message: " mesg
} )
switch
sync {
errorln "error : " code
errorln "message: " mesg
} )
switch "selector" "list of
conditions"
Example
const get-primary-color (color value) (
switch color (
("red" (return (value:substr 0 2))
("green" (return (value:substr 2 4))
("blue" (return (value:substr 4 6))
)
)
throw
switch color (
("red" (return (value:substr 0 2))
("green" (return (value:substr 2 4))
("blue" (return (value:substr 4 6))
)
)
throw throw what throw "id" throw
"id" "reason" throw "id" "reason"
"object"
Example
throw throw "type-error" throw
"type-error" "invalid argument"
trans
trans symbol "object" trans symbol
"argument" "body" trans symbol "argument"
"closed variables" "body"
Example
trans a 1 trans fact (n) (if (< n 1) 1 (* n (fact (- n
1))))
try
try "form" try "form" "
exception handler"
Example
try (+ 1 2) try (throw) try (throw "hello") try
(throw "hello" "world") try (throw "hello"
"world" "folks")
unref
unref symbol
Example
const number 123 unref number
while
while "condition" "body" while
"initial" "condition" "body"
Example
const gcd (u v) {
while (!= v 0) {
trans r (u:mod v)
u:= v
v:= r
}
eval u }
while (!= v 0) {
trans r (u:mod v)
u:= v
v:= r
}
eval u }
RESERVED OBJECTS¶
This chapter is a reference of the reserved objects with their respective builtin methods. The reserved objects are those objects defined in the global interpreter nameset and bind as reserved names. All literal have a string representation. The to-string method is always available for these reserved objects. A literal object has a default constructor. Generally, it can also be constructed by a same type object or by a string object. Literalliteral-p
Inheritance
Serial
Methods
to-string -> String (none)
The to-string method returns a string representation of the literal. The string
is expected to represent at best the literal.
to-literal -> String (none)
The to-literal method returns a string representation of the literal. The string
differs from the to-string method in the sense that the string is a literal
representation. For example the literal representation of a string is the
quoted string.
Nameable
nameable-p
Inheritance
Object
Methods
get-name -> String (none)
The get-name method returns the associated object name. The object name defined
here is a name that the class wishes to associate with the object. For
example, the InputFile is a nameable class and the name is the file
name.
Item
item-p
Inheritance
Literal
Operators
== -> Boolean (Boolean)
The == operator returns true if the calling object is equal to the boolean
argument.
!= -> Boolean (Boolean)
The == operator returns true if the calling object is not equal to the boolean
argument.
Methods
get-enum -> Enum (none)
The get-enum method returns the enumeration object bound to the item. The item
must be a dynamic item or an exception is thrown.
Boolean
boolean-p
Inheritance
Literal
Constructors
Boolean (none)
The Boolean constructor create a boolean object those default value is
false.
Boolean (Boolean)
The Boolean constructor create a boolean object with the boolean object
argument.
Boolean (String)
The Boolean constructor create a boolean object with the string object argument.
The string "true" denotes the true value while the string
"false" denotes the false value.
Operators
== -> Boolean (Boolean)
The == operator returns true if the calling object is equal to the boolean
argument.
!= -> Boolean (Boolean)
The == operator returns true if the calling object is not equal to the boolean
argument.
Number
number-p
Inheritance
Literal
Methods
format -> String (none|Integer)
The format method format the calling number instance with a certain number of
digits after the decimal point. In the first form without argument, the
default formating representation is performed with a null precision. In the
second format, a number is represented with a certain precision given by the
calling argument.
to-hexa -> String (none)
The to-hexa method returns a signed hexadecimal representation of a number. This
method works well with Integer and Relatif objects.
to-hexa-string -> String (none)
The to-hexa-string method returns a hexadecimal representation of a number
without a prefix. The number is always considered positive. This method works
well with Integer and Relatif objects.
Integer
integer-p
Inheritance
Number
Constructors
Integer (none)
The Integer constructor create an integer object those default value is 0.
Integer (Real)
The Integer constructor create an integer object with the real object argument
those value is truncated to an integer value.
Integer (Integer)
The Integer constructor create an integer object with the integer object
argument.
Integer (Character)
The Integer constructor create an integer object with the character object
argument. The character encoding value is used as the integer value.
Operators
== -> Boolean (Integer|Real)
The == operator returns true if the calling object is equal to the integer or
real argument.
!= -> Boolean (Integer|Real)
The != operator returns true if the calling object is not equal to the integer
or real argument.
+ -> Integer (Integer|Real)
The + operator returns the sum of the calling integer with an integer or a real
object.
- -> Integer (Integer|Real)
The - operator returns the subtraction of the calling integer with an integer or
a real object.
* -> Integer (Integer|Real)
The * operator returns the multiplication of the calling integer with an integer
or a real object.
/ -> Integer (Integer|Real)
The / operator returns the division of the calling integer with an integer or a
real object.
< -> Boolean (Integer|Real)
The < operator returns true if the calling integer is less than the integer
or real object.
<= -> Boolean (Integer|Real)
The <= operator returns true if the calling integer is less equal than the
integer or real object.
> -> Boolean (Integer|Real)
The > operator returns true if the calling integer is greater than the
integer or real object.
>= -> Boolean (Integer|Real)
The >= operator returns true if the calling integer is greater equal than the
integer or real object.
++ -> Integer (Integer|Real)
The ++ operator increments the calling integer by 1.
-- -> Integer (Integer|Real)
The -- operator decrements the calling integer by 1.
+= -> Integer (Integer|Real)
The += operator add and assign the calling integer with an integer or real
argument object.
-= -> Integer (Integer|Real)
The -= operator subtracts and assign the calling integer with an integer or real
argument object.
*= -> Integer (Integer|Real)
The *= operator multiply and assign the calling integer with an integer or real
argument object.
/= -> Integer (Integer|Real)
The /= operator divide and assign the calling integer with an integer or real
argument object.
Methods
or -> Integer (Integer)
The or method returns the binary or between the integer and the integer
argument.
abs -> Integer (none)
The abs method returns the absolute value of the calling integer instance.
not -> Integer (none)
The not method returns the binary negation of the calling integer
instance.
shl -> Integer (Integer)
The shl method returns a new integer corresponding to the calling integer
instance shifted left by the integer argument.
shr -> Integer (Integer)
The shr method returns a new integer corresponding to the calling integer
instance shifted right by the integer argument.
and -> Integer (Integer)
The and method returns a new integer corresponding to the binary and between the
calling integer instance and the integer argument.
xor -> Integer (Integer)
The xor method returns a new integer corresponding to the binary xor between the
calling integer instance and the integer argument.
mod -> Integer (Integer)
The mod method returns the modulo between the integer instance and the integer
argument. A type-error exception is raised if the argument is not an
argument.
odd-p -> Boolean (none)
The odd-p method returns true if the integer instance is odd, false
otherwise.
even-p -> Boolean (none)
The even-p method returns true if the integer instance is even, false
otherwise.
zero-p -> Boolean (none)
The zero-p method returns true if the integer instance is null, false
otherwise.
Relatif
relatif-p
Inheritance
Number
Constructors
Relatif (none)
The Relatif constructor create a relatif object those default value is 0.
Relatif (Real)
The Relatif constructor create an relatif object with the real object argument
those value is truncated to an integer value.
Relatif (Relatif)
The Relatif constructor create an relatif object with the relatif object
argument.
Relatif (Integer)
The Relatif constructor create an relatif object with the integer object
argument.
Relatif (Character)
The Relatif constructor create an relatif object with the character object
argument. The character encoding value is used as the relatif value.
Operators
== -> Boolean (Relatif|Integer)
The == operator returns true if the calling object is equal to the relatif or
integer argument.
!= -> Boolean (Relatif|Integer)
The == operator returns true if the calling object is not equal to the relatif
or integer argument.
+ -> Relatif (Relatif|Integer)
The + operator returns the sum of the calling relatif with an relatif or a
integer object.
- -> Relatif (Relatif|Integer)
The - operator returns the subtraction of the calling relatif with an relatif or
a integer object.
* -> Relatif (Relatif|Integer)
The * operator returns the multiplication of the calling relatif with an relatif
or a integer object.
/ -> Relatif (Relatif|Integer)
The / operator returns the division of the calling relatif with an relatif or a
integer object.
< -> Boolean (Relatif|Integer)
The < operator returns true if the calling relatif is less than the relatif
or integer object.
<= -> Boolean (Relatif|Integer)
The <= operator returns true if the calling relatif is less equal than the
relatif or integer object.
> -> Boolean (Relatif|Integer)
The > operator returns true if the calling relatif is greater than the
relatif or integer object.
>= -> Boolean (Relatif|Integer)
The >= operator returns true if the calling relatif is greater equal than the
relatif or integer object.
++ -> Relatif (Relatif|Integer)
The ++ operator increments the calling relatif by 1.
-- -> Relatif (Relatif|Integer)
The -- operator decrements the calling relatif by 1.
+= -> Relatif (Relatif|Integer)
The += operator add and assign the calling relatif with an relatif or integer
argument object.
-= -> Relatif (Relatif|Integer)
The -= operator subtracts and assign the calling relatif with an relatif or
integer argument object.
*= -> Relatif (Relatif|Integer)
The *= operator multiply and assign the calling relatif with an relatif or
integer argument object.
/= -> Relatif (Relatif|Integer)
The /= operator divide and assign the calling relatif with an relatif or integer
argument object.
Methods
or -> Relatif (Relatif)
The or method returns the binary or between the relatif and the relatif
argument.
abs -> Relatif (none)
The abs method returns the absolute value of the calling relatif instance.
not -> Relatif (none)
The not method returns the binary negation of the calling relatif
instance.
shl -> Relatif (Integer)
The shl method returns a new relatif corresponding to the calling relatif
instance shifted left by the integer argument.
shr -> Relatif (Integer)
The shr method returns a new relatif corresponding to the calling relatif
instance shifted right by the integer argument.
pow -> Relatif (Integer|Relatif|Integer
Integer|Relatif Relatif)
The pow method returns a new relatif corresponding to the power of the calling
relatif instance with the integer or relatif argument. With one argument, the
power is computed directly. With two arguments, a fast modular exponentiation
is performed with the second argument as the modulus.
mmi -> Relatif (Integer|Relatif)
The mmi method returns the multiplicative modular inverse of the calling
relatif. The argument is the modulus to use for the inverse calculation.
and -> Relatif (Relatif)
The and method returns a new relatif corresponding to the binary and between the
calling relatif instance and the relatif argument.
xor -> Relatif (Relatif)
The xor method returns a new relatif corresponding to the binary xor between the
calling relatif instance and the relatif argument.
mod -> Relatif (Relatif|Integer)
The mod method returns the modulo between the relatif instance and the relatif
or integer argument. A type-error exception is raised if the argument is
invalid.
odd-p -> Boolean (none)
The odd-p method returns true if the relatif instance is odd, false
otherwise.
even-p -> Boolean (none)
The even-p method returns true if the relatif instance is even, false
otherwise.
zero-p -> Boolean (none)
The zero-p method returns true if the relatif instance is null, false
otherwise.
get-msb -> Integer (none)
The get-msb method returns the most significnd bit position for the calling
relatif. If the number is null, 0 is returned. The msb position is thus
counted from 1.
Real
real-p
Inheritance
Number
Constructors
Real (none)
The Real constructor create an real object those default value is 0.0.
Real (Real)
The Real constructor create an real object with the real object argument.
Real (Integer)
The Real constructor create an real object with the integer object
argument.
Real (Character)
The Real constructor create an real object with the character object argument.
The character encoding value is used as the integer value.
Operators
== -> Boolean (Integer|Real)
The == operator returns true if the calling object is equal to the integer or
real argument.
!= -> Boolean (Integer|Real)
The == operator returns true if the calling object is not equal to the integer
or real argument.
+ -> Real (Integer|Real)
The + operator returns the sum of the calling real with an integer or a real
object.
- -> Real (Integer|Real)
The - operator returns the subtraction of the calling real with an integer or a
real object.
* -> Real (Integer|Real)
The * operator returns the multiplication of the calling real with an integer or
a real object.
/ -> Real (Integer|Real)
The / operator returns the division of the calling real with an integer or a
real object.
< -> Boolean (Integer|Real)
The < operator returns true if the calling real is less than the integer or
real object.
<= -> Boolean (Integer|Real)
The <= operator returns true if the calling real is less equal than the
integer or real object.
> -> Boolean (Integer|Real)
The > operator returns true if the calling real is greater than the integer
or real object.
>= -> Boolean (Integer|Real)
The >= operator returns true if the calling real is greater equal than the
integer or real object.
++ -> Real (Integer|Real)
The ++ operator increments the calling real by 1.
-- -> Real (Integer|Real)
The -- operator decrements the calling real by 1.
+= -> Real (Integer|Real)
The += operator add and assign the calling real with an integer or real argument
object.
-= -> Real (Integer|Real)
The -= operator subtracts and assign the calling real with an integer or real
argument object.
*= -> Real (Integer|Real)
The *= operator multiply and assign the calling real with an integer or real
argument object.
/= -> Real (Integer|Real)
The += operator divide and assign the calling real with an integer or real
argument object.
Methods
nan-p -> Boolean (none)
The nan-p method returns true if the calling real number instance is
not-a-number (nan).
ceiling -> Real (none)
The ceiling method returns the ceiling of the calling real number
instance.
floor -> Real (none)
The floor method returns the floor of the calling real number instance.
abs -> Real (none)
The abs method returns the absolute value of the calling real number
instance.
pow -> Real (Real|Integer)
The pow method returns the power of the calling real with the argument. The
exponent argument can be either an integer or a real number.
sqrt -> Real (none)
The sqrt method returns the square root of the calling real number
instance.
log -> Real (none)
The log method returns the natural logarithm of the calling real number
instance.
exp -> Real (none)
The exp method returns the exponential of the calling real number
instance.
sin -> Real (none)
The sin method returns the sine of the calling floating point instance. The
angle is expressed in radian.
cos -> Real (none)
The cos method returns the cosine of the calling floating point instance. The
angle is expressed in radian.
tan -> Real (none)
The tan method returns the tangent of the calling floating point instance. The
angle is expressed in radian.
asin -> Real (none)
The asin method returns the arc sine of the calling floating point instance. The
result is in radian.
acos -> Real (none)
The acos method returns the arc cosine of the calling floating point instance.
The result is in radian.
atan -> Real (none)
The atan method returns the arc tangent of the calling floating point instance.
The result is in radian.
sinh -> Real (none)
The sinh method returns the hyperbolic sine of the calling real number
instance.
cosh -> Real (none)
The cosh method returns the hyperbolic cosine of the calling real number
instance.
tanh -> Real (none)
The atan method returns the hyperbolic tangent of the calling real number
instance.
asinh -> Real (none)
The asinh method returns the hyperbolic arc sine of the calling real number
instance.
acosh -> Real (none)
The acosh method returns the hyperbolic arc cosine of the calling real number
instance.
atanh -> Real (none)
The atanh method returns the hyperbolic arc tangent of the calling real number
instance.
zero-p -> Boolean (none)
The zero-p method returns true if the calling real instance is null, false
otherwise.
Character
character-p
Inheritance
Literal
Constructors
Character (none)
The Character constructor create a character object those default value is the
null character.
Character (String)
The Character constructor create a character object with the string object
argument.
Character (Integer)
The Character constructor create a character object with the integer object
argument.
Character (Character)
The Character constructor create a character object with the character object
argument.
Operators
== -> Boolean (Character)
The == operator returns true if the calling object is equal to the character
argument.
!= -> Boolean (Character)
The != operator returns true if the calling object is not equal to the character
argument.
< -> Boolean (Character)
The < operator returns true if the calling character is less than the
character object.
<= -> Boolean (Character)
The <= operator returns true if the calling character is less equal than the
character object.
> -> Boolean (Character)
The > operator returns true if the calling character is greater than the
character object.
>= -> Boolean (Character)
The >= operator returns true if the calling character is greater equal than
the character object.
++ -> Character (Character)
The ++ operator increments the calling character by the next one in
lexicographic order.
-- -> Character (Character)
The -- operator decrements the calling character by the previous one in
lexicographic order.
+= -> Character (Integer)
The += operator add the integer argument to the calling character.
-= -> Character (Integer)
The -= operator subtracts the integer argument to the calling character.
Methods
letter-p -> Boolean (none)
The letter-p predicate returns true if the character is a letter character,
false otherwise.
digit-p -> Boolean (none)
The digit-p predicate returns true if the character is a digit character, false
otherwise.
alpha-p -> Boolean (none)
The alpha-p predicate returns true if the character is an alphanumeric
character, false otherwise.
blank-p -> Boolean (none)
The blank-p predicate returns true if the character is a blank or tab character,
false otherwise.
eol-p -> Boolean (none)
The eol-p predicate returns true if the character is an end-of-line character,
false otherwise.
eos-p -> Boolean (none)
The eos-p predicate returns true if the character is an end-of-stream character,
false otherwise.
nil-p -> Boolean (none)
The nil-p predicate returns true if the character is the nil character, false
otherwise.
to-integer -> Integer (none)
The to-integer method returns an integer representation of the characters.
Byte
byte-p
Inheritance
Serial
Constructors
Byte (none)
The Byte constructor create a byte object those default value is the null
byte.
Byte (Integer)
The Byte constructor create a byte object with the integer object argument. The
integer value must be in the range of 0x00 to 0xFF.
Byte (Byte)
The Byte constructor create a byte object with the byte object argument.
Operators
== -> Boolean (Byte)
The == operator returns true if the calling object is equal to the byte
argument.
!= -> Boolean (Byte)
The != operator returns true if the calling object is not equal to the byte
argument.
< -> Boolean (Byte)
The < operator returns true if the calling byte is less than the byte
object.
<= -> Boolean (Byte)
The <= operator returns true if the calling byte is less equal than the byte
object.
> -> Boolean (Byte)
The > operator returns true if the calling byte is greater than the byte
object.
>= -> Boolean (Byte)
The >= operator returns true if the calling byte is greater equal than the
byte object.
++ -> Byte (Byte)
The ++ operator increments the calling byte by one.
-- -> Byte (Byte)
The -- operator decrements the calling byte by one.
+= -> Byte (Integer)
The += operator adds the integer argument to the calling byte.
-= -> Byte (Integer)
The -= operator subtracts the integer argument to the calling byte.
Methods
eos-p -> Boolean (none)
The eos-p predicate returns true if the character is an end-of-stream character,
false otherwise.
nil-p -> Boolean (none)
The nil-p predicate returns true if the byte is the nil byte, false
otherwise.
to-integer -> Integer (none)
The to-integer method returns an integer representation of the byte.
to-char -> Character (none)
The to-char method returns a character representing the byte.
String
string-p
Inheritance
Literal
Constructors
String (none)
The String constructor create a string object those default value is the null
string.
String (Literal)
The String constructor create a string object with the literal object
argument.
Operators
== -> Boolean (String)
The == operator returns true if the calling object is equal to the string
argument.
!= -> Boolean (String)
The != operator returns true if the calling object is not equal to the string
argument.
< -> Boolean (String)
The < operator returns true if the calling string is less than the string
argument.
<= -> Boolean (String)
The <= operator returns true if the calling string is less equal than the
string argument.
> -> Boolean (String)
The > operator returns true if the calling string is greater than the string
argument.
>= -> Boolean (String)
The >= operator returns true if the calling string is greater equal than the
string argument.
+ -> String (String)
The + operator returns the sum of the calling string with an string
object.
+= -> String (String)
The += operator add and assign the calling string with the string
argument.
Methods
length -> Integer (none)
The length method returns the length of the string.
first -> Character (none)
The first method returns the first character in the string.
last -> Character (none)
The last method returns the last character in the string.
strip-left -> String (none|String)
The strip-left method removes the leading blanks and tabs and returns a new
string. With a string argument, each character in the string is taken as a
character separator that should be stripped.
strip-right -> String (none|String)
The strip-right method removes the trailing blanks and tabs and returns a new
string.With a string argument, each character in the string is taken as a
character separator that should be stripped.
strip -> String (none|String)
The strip method removes the leading, trailing blanks and tabs and returns a new
string. With a string argument, each character in the string is taken as a
character separator that should be stripped.
split -> Vector (none|String)
The split method split the string into one or more string according to break
sequence. If no argument is passed to the call, the break sequence is assumed
to be a blank, tab and eol characters.
extract -> Vector (Character)
The extract method extracts one or more string which are enclosed by a control
character passed as an argument. The method returns a vector of strings.
to-upper -> String (none)
The to-upper converts all string characters to upper case and returns a new
string.
to-lower -> String (none)
The to-lower method converts all string characters to lower case and returns a
new string.
get -> Character (Integer)
The get method returns a the string character at the position given by the
argument. If the index is invalid, an exception is raised.
sub-left -> String (Integer)
The sub-left method returns the left sub string of the calling string up-to the
argument index. If the index is out of range, the string is returned.
sub-right -> String (Integer)
The sub-right method returns the right sub string of the calling string starting
at the argument index. If the index is out of range, the string is
returned.
fill-left -> String (Character Integer)
The fill-left method returns a string filled on the left with the character
argument. The second argument is the desired length of the resulting string.
If the calling is too long, the string is returned.
fill-right -> String (Character Integer)
The fill-left method returns a string filled on the right with the character
argument. The second argument is the desired length of the resulting string.
If the calling is too long, the string is returned.
substr -> String (Integer Integer)
The substr method returns a string starting at the first argument index and
ending at the second argument index. If the indexes are out of range, an
exception is raised.
Regex
Character | Description |
$a | matches any letter or digit |
$b | matches any blank characters |
$c | matches any combining characters |
$d | matches any digit |
$e | matches eol, cr and eos |
$l | matches any lower case letter |
$n | matches eol or cr |
$s | matches any letter |
$u | matches any upper case letter |
$v | matches any valid constituent |
$w | matches any word constituent |
$x | matches any hexadecimal characters |
Character | Description |
$A | any character except letter or digit |
$B | any character except blank characters |
$C | any character except combining characters |
$D | any character except digit |
$E | any character except eol, cr and eos |
$L | any character except lower case letter |
$N | any character except eol or cr |
$S | any character except letter |
$U | any character except upper case letter |
$V | any character except constituent |
$W | any character except word constituent |
$X | any character except hex characters |
Operator | Description |
* | match 0 or more times |
+ | match 1 or more times |
? | match 0 or 1 time |
| | alternation |
regex-p
Inheritance
Literal
Constructors
Regex (none)
The Regex constructor create a regex object those default value is the null
regex.
Regex (String)
The Regex constructor create a regex object with the string object argument. The
string argument is the regex specification.
Operators
== -> Boolean (String)
The == operator returns true if the argument is matched by the regex.
!= -> Boolean (String)
The != operator returns true if the argument is not matched by the regex.
< -> Boolean (String)
The < operator returns true if the argument is partially matched by the
regex.
Methods
length -> Integer (none)
The length method returns the length of the group vector when a regex match has
been successful.
get -> String (Integer)
The get method returns by index the group sub-string when a regex match has been
successful.
match -> String (String)
The match method returns the first matching string of the argument string.
replace -> String (String String)
The replace method returns a string constructed by replacing all matching
sub-string -- from the first argument -- with the second argument
string.
CONTAINER OBJECTS¶
This chapter is a reference of the reserved container objects with their respective builtin methods. Some of these container objects are iterable objects. When an object is iterable, an iterator constructor constructor is provided. The iterable-p predicate returns true if the container is an iterable object. The get-iterator method can be used to construct an object iterator. For a given iterator, the predicates end-p and valid-p can be used to check for the end or a valid iterator position. The next method move the iterator to its next position. The prev method move the iterator -- if possible -- to its previous position. The get-object method returns the object at the current iterator position. Conscons-p
Inheritance
SerialIterable
Constructors
Cons (none)
The Cons constructor create a default cons cell with the car and cdr set to
nil.
Cons (Objects...)
The Cons constructor create a list of cons cells with the object arguments. Each
argument object is assigned to the car of the cons cell while the cdr is used
to link the cell together.
Methods
get-car -> Object (none)
The get-car method returns the car of the calling cons cell.
get-cdr -> Cons (none)
The get-cdr method returns the cdr of the calling cons cell.
get-cadr -> Object (none)
The get-cadr method returns the car of the cdr of the calling cons cell or nil
if the cdr is nil.
get-caddr -> Object (none)
The get-caddr method returns the car of the cdr of the cdr of the calling cons
cell or nil if the cdr is nil.
get-cadddr -> Object (none)
The get-cadddr method returns the car of the cdr of the cdr of the cdr of the
calling cons cell or nil if the cdr is nil.
length -> Integer (none)
The length method returns the length of the cons cell. The minimum length
returned is always 1.
nil-p -> Boolean (none)
The nil-p predicate returns true if the car of the calling cons cell is nil,
false otherwise.
block-p -> Boolean (none)
The block-p predicate returns true if the cons cell is of type block, false
otherwise.
get-iterator -> Iterator (none)
The get-iterator returns a forward iterator for this cons cell. No backward
methods are supported for this object.
set-car -> Object (Object)
The set-car set the car of the calling cons cell. The object argument is
returned by the method.
set-cdr -> Cons (Cons)
The set-cdr set the cdr of the calling cons cell. The cons cell argument is
returned by the method.
add -> Object (Object)
The add method appends an object at the end of the cons cell chain by creating a
new cons cell and linking it with the last cdr. The object argument is
returned by this method.
get -> Object (Integer)
The get method returns the car of the cons cell chain at a certain position
specified by the integer index argument.
Enum
enum-p
Inheritance
Object
Constructors
Enum (none)
The Enum constructor create an empty enumeration.
Enum (String...)
The Enum constructor create an enumeration from a list of string
arguments.
Methods
reset -> none (none)
The reset method resets the enumeration and makes it empty.
length -> Integer (none)
The length method returns the number of items in the enumeration.
exists-p -> Boolean (String)
The exists-p predicate returns true if the name argument exists as an item. The
name argument must be a lexical name or an exception is thrown.
add -> none (String)
The add method adds a new item to the enumeration by name. This method returns
nil.
get -> String (Integer)
The get method returns an item string representation by index. The integer
argument is the item index.
List
list-p
Inheritance
Iterable
Constructors
List (none)
The List constructor create an empty list.
List (Object...)
The List constructor create a list from a list of object arguments.
Methods
length -> Integer (none)
The length method returns the length of the list. The minimum length is 0 for an
empty list.
get-iterator -> Iterator (none)
The get-iterator returns a forward/backward iterator for this list.
add -> Object (Object)
The add method appends an object at the end of the list. The object argument is
returned by this method.
insert -> Object (Object)
The insert method inserts an object at the beginning of the list. The object
argument is returned by this method.
get -> Object (Integer)
The get method returns the object in the list at a certain position specified by
the integer index argument.
Strvec
strvec-p
Inheritance
Serial
Constructors
Strvec (none)
The Strvec constructor create an empty string vector.
Strvec (Integer|Boolean)
The Strvec constructor create a string vector with a predefined size or with a
uniq flag. In the first form, the preferred vector size is given as an
argument. In the second form, the string unicity flag is given as an
argument.
Strvec (Integer Boolean)
The Strvec constructor create a string vector with a predefined size and a uniq
flag. The first argument is the preferred vector size. The second argument is
the string unicity flag.
Methods
reset -> none (none)
The reset method resets the string vector. When the method is complete, the
string vector is empty.
length -> Integer (none)
The length method returns the length of the string vector. The minimum length is
0 for an empty vector.
min-length -> Integer (none)
The min-length method returns the minimum string length of the string
vector.
max-length -> Integer (none)
The max-length method returns the maximum string length of the string
vector.
empty-p -> Boolean (none)
The empty-p predicate returns true if the vector is empty.
active-p -> Boolean (none)
The active-p predicate returns true if the vector is not empty. This predicate
is the negation of the empty-p predicate.
get -> String (Integer)
The get method returns the string in the vector at a certain position specified
by the integer index argument.
set -> none (Integer String)
The set method set a vector position with a string. The first argument is the
vector index. The second argument is the string to set.
first -> String (none)
The first method returns the first string in the vector.
last -> String (none)
The last method returns the last string in the vector.
pop -> Object (none)
The pop method removes the first element in the string vector and returns
it.
pop-last -> String (none)
The pop-last method removes the last element in the string vector and returns
it.
find -> Integer (String)
The find method try to find a string in the vector. If the string is found, the
vector index is returned else the -1 value is returned.
lookup -> Integer (String)
The lookup method try to find a string in the vector. If the string is found,
the vector index is returned else an exception is raised.
add -> none (String)
The add method adds an object at the end of the vector. If the uniq flag is
active, the string argument is not added if it already exists.
exists-p -> Boolean (String)
The exists-p method returns true if the string argument exists in the
vector.
remove -> none (Integer|String)
The remove method removes a string from the vector by index or value. In the
first form, the vector index is used as the place to remove. In the second
form, the string argument is used as a key for removal. This method repacks
the vector when the string has been removed.
set-unique -> none (Boolean)
The set-unique method set the string vector unique flag. When the unique flag is
set, there is only no string duplicate in the vector.
get-unique -> Boolean
The get-unique method returns the string vector unique flag value.
concat -> String (none | Character)
The concat method concatenates the string vector elements with a character
separator. In the first form, with a separator character, the resulting string
is the concatenation of the string vector elements. In the second form, the
resulting string is the concatenation of the vector elements with a character
separator. If the character separator is nil then no separator is
placed.
Vector
vector-p
Inheritance
SerialIterable
Constructors
Vector (none)
The Vector constructor create an empty vector.
Vector (Object...)
The Vector constructor create a vector from a list of object arguments.
Methods
reset -> none (none)
The reset method reset the vector. When the method is complete, the vector is
empty.
length -> Integer (none)
The length method returns the length of the vector. The minimum length is 0 for
an empty vector.
empty-p -> Boolean (none)
The empty-p predicate returns true if the vector is empty.
get -> Object (Integer)
The get method returns the object in the vector at a certain position specified
by the integer index argument.
set -> Object (Integer Object)
The set method set a vector position with an object. The first argument is the
vector index. The second argument is the object to set. The method returns the
object to set.
first -> Object (none)
The first method returns the first element in the vector.
last -> Object (none)
The last method returns the last element in the vector.
pop -> Object (none)
The pop method removes the first element in the vector and returns it.
pop-last -> Object (none)
The pop-last method removes the last element in the vector and returns it.
find -> Integer (Object)
The find method try to find an object in the vector. If the object is found, the
vector index is returned as an Integer object, else nilp is returned.
add -> Object (Object|Integer Object)
The add method appends an object at the end of the vector or at a certain index.
In the first form, the object argument is added at the end of the vector. In
the second form, the object argument is inserted in the vector at the
specified index. In both cases, the object argument is returned by this
method.
exists-p -> Boolean (Object)
The exists-p method returns true if the object argument exists in the vector.
This method is useful to make sure that only one occurrence of an object is
added to a vector.
clean -> none (Integer)
The clean method removes an object from the vector by index and repack the
vector.
remove -> none (Object)
The remove method removes an object from the vector and repack the vector. If
duplicate exists in the file, only one is removed.
get-iterator -> Iterator (none)
The get-iterator returns a forward/backward iterator for this vector.
HashTable
hashtable-p
Inheritance
Object
Constructors
HashTable (none)
The HashTable constructor create an empty table.
HashTable (Integer)
The HashTable constructor create a table with a specific size.
Methods
add -> none (String Object)
The add method adds a new object in the table by key. The first argument is the
key used to associate the object in the table. The second argument is the
object to add.
length -> Object (none)
The length returns the number of objects in the table.
empty-p -> Boolean (none)
The empty-p predicate returns true if the table is empty.
reset -> none (none)
The reset method resets the table so that it becomes empty.
get -> Object (String)
The get method returns the object associated with a key. If the key is not
found, nil is returned.
lookup -> Object (String)
The lookup method returns the object associated with a key. If the key is not
found, an exception is raised.
get-key -> String (Integer)
The get-key method returns the key associated with an entry in the table by
index. If the index is out of range, an exception is raised.
get-object -> Object (Integer)
The get-object method returns the object associated with an entry in the table
by index. If the index is out of range, an exception is raised.
Set
set-p
Inheritance
SerialIterable
Constructors
Set (none)
The Set constructor create an empty set.
Set (Object...)
The Set constructor create a set from a list of object arguments.
Methods
reset -> none (none)
The reset method reset the set. When the method is complete, the set is
empty.
length -> Integer (none)
The length method returns the number of elements in the set. The minimum length
is 0 for an empty set.
add -> Object (Object)
The add method appends an object in the set. If the object already exists in the
set, it is not added twice. This is the main difference between a set and a
vector. The object argument is returned by this method.
get -> Object (Integer)
The get method return object by index.
empty-p -> Boolean (Object)
The empty-p predicate returns true if the set is empty.
exists-p -> Boolean (Object)
The exists predicate returns true if the object argument exists in the
set.
merge -> none (Set)
The merge method merges the set argument into the calling set. If an element
already exists in the set, it is not added.
remix -> none (Integer)
The remix method mixes the set by randomly swapping all the elements. This
method is useful when the set has been filled with a certain order by the
access must be done randomly.
remove -> Boolean (Object)
The remove method removes the object argument from the set. if the object is
removed, the method returns true. If the object is not in the set, the method
returns false.
get-random-subset -> Set (Integer)
The get-random-subset method returns a subset those cardinal is at least the
size argument with a set of randomly chosen elements. The result set might
have a cardinal less than the requested size if the calling set cardinal is
less than the requested size.
get-iterator -> Iterator (none)
The get-iterator returns an iterator for this set. The iterator supports forward
and backward iteration.
Queue
queue-p
Inheritance
Object
Constructors
Queue (none)
The Queue constructor create an empty queue.
Queue (Object...)
The Queue constructor create a queue with a list of object arguments
Methods
enqueue -> Object (Object)
The enqueue adds an object in the queue and returns the queued object.
dequeue -> Object (none)
The dequeue dequeue an object in the order it was queued.
length -> Object (none)
The length returns the number of queued objects.
empty-p -> Boolean (none)
The empty-p method returns true if the queue is empty.
flush -> none (none)
The flush method flushes the queue so that it is empty.
Heap
heap-p
Inheritance
Object
Constructors
Heap (none)
The Heap constructor create an empty heap. By default the heap operates in
ascending mode.
Heap (Integer)
The Heap constructor create a heap with a specific size. By default the heap
operates in ascending mode.
Heap (Boolean)
The Heap constructor create a heap with a specific mode. If the mode is true,
the heap operates in ascending order. If the mode is false, the heap operates
in descending order. In ascending order, the first object is the object with
the lowest key.
Heap (Integer Boolean)
The Heap constructor create a heap with a specific size and mode. The first
argument is the heap size. The second argument is the heap mode. If the mode
is true, the heap operates in ascending order. If the mode is false, the heap
operates in descending order. In ascending order, the first object is the
object with the lowest key.
Methods
add -> none (Integer Object)
The add method adds a new object in the heap by key. The first argument is the
key used to set the object position in the heap. The second argument is the
object to add.
pop -> Object (none)
The pop pops the first available in the heap. If the heap is empty, an exception
is raised.
length -> Object (none)
The length returns the number of objects in the heap.
empty-p -> Boolean (none)
The empty-p method returns true if the heap is empty.
reset -> none (none)
The reset method reset the heap so that it becomes empty.
get-key -> Integer (Integer)
The get-key method returns the key associated with an entry in the heap by
index. If the index is out of range, an exception is raised.
get-object -> Object (Integer)
The get-object method returns the object associated with an entry in the heap by
index. If the index is out of range, an exception is raised.
get-mode -> Boolean (none)
The get-mode method returns the heap operating mode. If the mode is true, the
heap operates in ascending order. If the mode is false, the heap operates in
descending order. In ascending order, the first object is the object with the
lowest key.
min-key-p -> Boolean (none)
The min-key-p predicate returns true if a minimum key has been set. The
get-min-key method can be used to retrieve the minimum key value.
max-key-p -> Boolean (none)
The max-key-p predicate returns true if a maximum key has been set. The
get-max-key method can be used to retrieve the maximum key value.
reset-min-key -> none (none)
The reset-min-key method resets the minimum key flag and value.
reset-max-key -> none (none)
The reset-max-key method resets the maximum key flag and value.
set-min-key -> none (Integer)
The set-min-key method sets the minimum key value.
get-min-key -> Integer (none)
The get-min-key method returns the minimum key value.
set-max-key -> none (Integer)
The set-max-key method sets the maximum key value.
get-max-key -> Integer (none)
The get-max-key method returns the maximum key value.
resize -> none (none)
The resize method resize the heap with a new size. if the size is lower than the
number of elements, the procedure does nothing.
Bitset
bitset-p
Inheritance
Object
Constructors
Bitset (none)
The BitSet constructor create an empty bitset.
Bitset (Integer)
The Bitset constructor create a bitset those size is given by the integer
argument.
Bitset (String)
The Bitset constructor create a bitset by parsing the string argument. The
string can be either in the normal binary form with or without the 0b prefix
or in hexadecimal form with the 0x prefix.
Bitset (Buffer Boolean)
The Bitset constructor create a bitset from a buffer content. Each byte in the
buffer is to be placed in the bitset. The boolean argument is the ascending
flag. When true the buffer bytes are used in ascending index order, thus
making the fist byte in the buffer to be used as the first right byte in the
bitset. When false, the buffer bytes are used in descending index order, thus
making the last byte in the buffer to be used as the first byte in the
bitset.
Methods
reset -> none (none)
The reset method reset the bitset and force the initial size to 0.
marked-p -> Boolean (Integer)
The marked-p predicate returns true if the bit is set at the index
argument.
clear -> none (Integer)
The clear method clears a bit by the index argument.
mark -> none (Integer)
The mark method marks a bit by the index argument.
mark -> none (Integer Boolean)
The mark method set the bit value by the index argument with the boolean second
argument.
add -> none (Integer Boolean)
The add method add a bit in the bitset at the given position. The first argument
is the bit position and the second argument is the bit value. The add method
is the only method that resize a bitset.
set -> none (Integer|String)
The set method set a bitset with an integer value. In the first form with an
integer argument, the bitset is completely reset to a 64 bits bitset and the
value set as an unsigned integer. In the second form with a string argument,
the bitset is reset and the string argument is parsed as a binary string with
or without binary prefix or as a hexadecimal string.
clamp -> none (Boolean)
The clamp method clamp a bitset by boolean value. The bitset size is determined
by finding the upper bit index that match the boolean argument.
length -> Integer (none)
The length method returns the length of the bitset in bits.
to-byte -> Integer (Byte)
The to-byte method maps a portion of the bitset to a byte at a specific
position. The integer argument is the bit position that is mapped to the byte
lsb.
subset -> Integer (Bitset)
The subset method returns a sub bitset by size.
subset -> Integer Integer (Bitset)
The subset method returns a sub bitset by size and position. The first integer
argument is the sub bitset size. The second argument is the bitset position
where the sub bitset is extracted.
Buffer
buffer-p
Inheritance
Object
Constructors
Buffer (none)
The Buffer constructor create an empty buffer. The buffer is configured to
operate in resize mode.
Buffer (Literal...)
The Buffer constructor create a buffer with a list of literal object arguments.
Each literal argument is used to produce a byte representation which is added
into the buffer.
Methods
add -> Integer (Byte|Literal|Buffer)
The add method adds a byte, a literal object or a buffer to the calling buffer.
The object argument is automatically converted to a sequence of bytes. For a
buffer, the entire content is copied into the buffer. The method returns the
number of bytes added into the buffer.
get -> Byte (none)
The get method returns the next available byte in the buffer but do not remove
it.
read -> Byte (none)
The read method returns the next available character and remove it from the
buffer.
reset -> none (none)
The reset method reset the entire buffer and destroy its contents.
length -> Integer (none)
The length method returns the length of the buffer.
full-p -> Boolean (none)
The full-p predicate return true if the buffer is full. If the buffer is
re-sizeable, the method always return false.
empty-p -> Boolean (none)
The empty-p predicate return true if the buffer is empty.
resize-p -> Boolean (none)
The resize-p predicate return true if the buffer is re-sizeable.
to-string -> String (none)
The to-string method returns a string representation of the buffer.
format -> String (none)
The format method returns an octet string representation of the buffer.
pushback -> Integer (Byte|Literal|Buffer)
The pushback method push back a byte, a literal object or a buffer in the
calling buffer. The object argument is automatically converted to a sequence
of bytes. For a buffer, the entire content is copied into the buffer. The
method returns the number of byte pushbacked.
get-host-word -> Integer (none)
The get-host-word method reads a word from the buffer and convert it to an
integer. The word is assumed to be in network byte order and is converted into
the host byte order before becoming an integer.
get-host-quad -> Integer (none)
The get-host-quad method reads a quad from the buffer and convert it to an
integer. The quad is assumed to be in network byte order and is converted into
the host byte order before becoming an integer.
get-host-octa -> Integer (none)
The get-host-octa method reads an octa from the buffer and convert it to an
integer. The octa is assumed to be in network byte order and is converted into
the host byte order before becoming an integer.
set-resize -> none (Boolean)
The set-resize method set the resize flag for a particular buffer. This method
can be used at any time.
shl -> none (Integer)
The shl method shift left the buffer by a certain number of characters. The
integer argument is the number of characters to shift.
BlockBuffer
block-buffer-p
Inheritance
Buffer
Constructors
BlockBuffer (none)
The BlockBuffer constructor create a non-resizable empty block buffer.
BlockBuffer (Integer)
The BlockBuffer constructor create a non-resizable block buffer. The integer
argument is the block buffer size.
Methods
read-count -> Integer (none)
The read-count method returns the number of characters read by the buffer. The
read counter is increased during any read operation that might decrease the
buffer length.
write-count -> Byte (none)
The write-count method returns the number of characters writen into the
buffer.
copy -> Integer
(String|Buffer|InputStream|OutputStream)
The copy method copies an object into or from the block buffer. Inthe first
form, a string, a buffer or an input stream is isued to fill the buffer. If
the buffer is resizable, the whole contents of the objects are copied into the
block buffer. If the buffer is not resizable, the copy operation stops when
the buffer is full. The copy method consumes characters with a buffer or an
input stream object. With an output stream object, the block buffer characters
are consumed while beeing written to the output stream. The total number of
characters copied is returned by this method. When using a multiple types
object that implements both the input and output stream model, the priority is
given to the input stream type.
copy-input-stream -> Integer (InputStream)
The copy-input-stream method copies an input stream into the block buffer. This
method is similar to the copy method except that it operates only with an
input stream. Such method is usefull when using object that implements
multiple stream types.
copy-output-stream -> Integer (OutputStream)
The copy-output-stream method copies an output stream into the block buffer.
This method is similar to the copy method except that it operates only with an
output stream. Such method is usefull when using object that implements
multiple stream types.
Property
property-p
Inheritance
Serial
Constructors
Property (none)
The Property constructor create an empty property.
Property (String)
The Property constructor create a property by name. The first argument is the
property name.
Property (String Literal)
The Property constructor create a property by name and value. The first argument
is the property name. The second argument is the property value.
Property (String String Literal)
The Property constructor create a property by name, info and value. The first
argument is the property name. The second argument is the property info. The
third argument is the property value.
Methods
set -> none (String Literal)
The set method sets the property name and value. The first argument is the
property name. The second argument is the property value, which is a literal
converted to its string representation.
set-name -> none (String)
The set-name method sets the property name.
get-name -> String (none)
The get-name method returns the property name.
set-info -> none (String)
The set-info method sets the property information.
get-info -> String (none)
The get-info method returns the property information.
set-value -> none (Literal)
The set-value method sets the property value. The literal argument is converted
to its string representation.
get-value -> String (none)
The get-value method returns the property string value.
get-boolean-value -> Boolean (none)
The get-boolean-value method returns the property boolean value.
get-integer-value -> Integer (none)
The get-integer-value method returns the property integer value.
get-real-value -> Real (none)
The get-real-value method returns the property real value.
Plist
plist-p
Inheritance
SerialIterableNameable
Constructors
Plist (none)
The Plist constructor create an empty property list.
Plist (String)
The Plist constructor create a property list by name.
Plist (String String)
The Plist constructor create a property list by name and info.
Methods
set-name -> none (String)
The set-name method sets the property list name.
set-info -> none (String)
The set-info method sets the property list info.
get-info -> String (none)
The get-info method returns the property list info.
add -> none (Property | String Literal | String
String Literal)
The add method add a property by object or name and value in the property list.
In its first form the object is a property object. In the second form, the
first argument is the property name and the second argument is the property
value. In the the third form the first argument is the property name, the
second argument is the property info and the this argument is the property
value. if the property already exists an exception is raised.
set -> none (String Literal)
The set method add or sets the property name and value in the property list. The
first argument is the property name. The second argument is the property
value. If the property already exists, the property value is changed.
get -> Property (Integer)
The get method returns a property by index.
reset -> none (none)
The reset method resets the property lists
empty-p -> Boolean (none)
The emptyp- predicate returns true if the property list is empty.
length -> Integer (none)
The length method returns the number of properties in the property list.
exists-p -> Boolean (String)
The exists-p method returns true if a property exists. The string argument is
the property name.
find -> Property (String)
The find method finds a property by name. The string argument is the property
name. If the property does not exists, nil is returned.
lookup -> Property (String)
The lookup method finds a property by name. The string argument is the property
name. If the property does not exists, an exception is raised.
get-value -> String (String)
The get-value method returns the property value. The string argument is the
property name. If the property does not exist, an exception is raised.
to-print-table -> PrintTable (none | Boolean |
Boolean Boolean)
The to-print-table method converts the property list into a print table. The
print table can be formated with the property info and value. In the first
form, the print table is formated without the info field in normal value. In
the second form, the boolean flag controls whther or not the info field is
added in the table. In the third form, the second boolean value controls
whther or not the real property value are converted in scientific
notation.
SPECIAL OBJECTS¶
This chapter is a reference of the reserved special objects with their respective built-in methods. Special objects are those objects which interact with the interpreter. Objectrepr -> String (none)
The repr method returns the object name in the form of a string. The result
string is called the representation string.
rdlock -> none (none)
The rdlock method try to acquire the object in read-lock mode. If the object is
currently locked in write mode by another thread, the calling thread is
suspended until the lock is released.
wrlock -> none (none)
The wrlock method try to acquire the object in write-lock mode. If the object is
currently locked by another thread, the calling thread is suspended until the
lock is released.
unlock -> none (none)
The unlock method try to unlock an object. An object will be unlocked if and
only if the calling thread is the one who acquired the lock.
clone -> Object (none)
The clone method returns a clone of the calling object. If the object cannot be
cloned, an exception is raised.
Interp
interp-p
Inheritance
Runnable
Constants
argv
The argv data member holds the interpreter argument vector. The vector is
initialized when the interpreter is created. Each argument is stored as a
string object.
os-name
The os-name data member holds the operating system name. The data member
evaluates as a string.
os-type
The os-type data member holds the operating system type. The data member
evaluates as a string.
version
The version data member holds the full engine version. The data member evaluates
as a string.
program-name
The program-name data member holds the interpreter program name. The data member
evaluates as a string.
major-version
The major-version data member holds the interpreter major revision number. The
data member evaluates as an integer.
minor-version
The minor-version data member holds the interpreter minor revision number. The
data member evaluates as an integer.
patch-version
The patch-version data member holds the interpreter patch revision number. The
data member evaluates as an integer.
afnix-uri
The afnix-uri data member holds the official uri. The data member evaluates as a
string.
machine-size
The machine-size data member holds the interpreter machine size expressed in
bits. Most of the time, the machine size is either 32 or 64 bits. If something
else is returned, it certainly reflects an exotic platform.
loader
The loader data member holds the interpreter library loader. Under normal
circumstances, the library loader should not be used and the standard
interp:library form should be used.
resolver
The resolver data member holds the interpreter resolver. The resolver can be
used to add dynamically a librarian or a directory to the interpreter module
resolver.
Methods
load -> Boolean (String)
The load method opens a file those name is the method argument and executes each
form in the file by doing a read-eval loop. When all forms have been executed,
the file is closed and the method returns true. In case of exception, the file
is closed and the method returns false.
library -> Library (String)
The library method opens a shared library and a returns a shared library
object.
launch -> Thread (form|thread form)
The launch method executes the form argument in a normal thread. The normal
thread is created by cloning the current interpreter. In the first form, a
thread object is created by the method and return when the thread as been
launched. In the second form, a thread is started by binding a form to the
thread object.
set-epsilon -> none (Real)
The set-epsilon method sets the interpreter epsilon which corresponds to the
real precision. The real precision is used by the ?= operator to compare real
values.
get-epsilon -> Real (none)
The get-real precision method returns the interpreter epsilon which correspond
to the real precision. The real-precision is used by the ?= operator to
compare real values.
dup -> Interp (none|Terminal)
The dup method returns a clone of the current interpreter by binding the
terminal steam argument. Without argument, a new terminal object is
automatically created and bound to the newly created interpreter.
loop -> Boolean (none)
The loop method executes the interpreter main loop by reading the interpreter
input stream. The loop is finished when the end-of-stream is reached with the
input stream. The method returns a boolean flag to indicate whether or not the
loop was successful.
set-primary-prompt -> none (String)
The set-primary-prompt method sets the interpreter terminal primary prompt which
is used during the interpreter main loop.
set-secondary-prompt -> none (String)
The set-secondary-prompt method sets the interpreter terminal secondary prompt
which is used during the interpreter main loop.
get-primary-prompt -> String (none)
The get-primary-prompt method returns the interpreter terminal primary
prompt.
get-secondary -> String (none)
The get-secondary-prompt method returns the interpreter terminal secondary
prompt.
Thread
thread-p
Inheritance
Object
Constructors
Thread (none)
The Thread constructor create a default thread object without any form bound to
it. The object can be later used with the launch command.
Methods
end-p -> none (none)
The end-p predicate returns true if the thread argument has finished. This
predicate indicates that the thread result is a valid one.
wait -> none (none)
The wait method suspends the calling thread until the thread argument as
completed. The wait method is the primary mechanism to detect a thread
completion.
result -> Object (none)
The result method returns the thread result. If the thread is not completed, the
nil value is returned. However, this method should not be used to check if a
thread has completed and the wait method must be used because a thread result
might be nil.
Condvar
condvar-p
Inheritance
Object
Constructors
Condvar (none)
The Condvar constructor creates a default condition variable.
Methods
lock -> none (none)
The lock method locks the condition variable mutex. If the mutex is already
locked, the calling thread is suspended until the lock is released. When the
method returns, the resumed thread owns the condition variable lock. It is the
thread responsibility to reset the condition variable and unlock it.
mark -> none (none)
The mark method marks the condition variable and notify all pending threads of
such change. The mark method is the basic notification mechanism.
wait -> none (none)
The wait method waits for a condition variable to be marked. When such condition
occurs, the suspended thread is run. When the method returns, the resumed
thread owns the condition variable lock. It is the thread responsibility to
reset the condition variable and unlock it.
reset -> none (none)
The reset method acquires the condition variable mutex, reset the mark, and
unlock it. If the lock has been taken, the calling thread is suspended.
unlock -> none (none)
The unlock method unlock the condition variable mutex. This method should be
used after a call to lock or wait.
wait-unlock -> none (none)
The wait-unlock method wait until a condition variable is marked. When such
condition occurs, the suspended thread is run. Before the method returns, the
condition variable is reset and the mutex unlocked. With two threads to
synchronize, this is the preferred method compared to wait.
Lexical
lexical-p
Inheritance
Literal
Constructors
Lexical (none)
The Lexical constructor create an empty lexical object which evaluates to
nil.
Lexical (String)
The Lexical constructor create a lexical object using the string argument as the
lexical name.
Methods
map -> Object (none)
The map method returns the object that is mapped by the lexical name. Most of
the time, a symbol object is returned since it is the kind of object stored in
a nameset. Eventually the mapping might returns an argument object if used
inside a closure.
Qualified
qualified-p
Inheritance
Literal
Constructors
Qualified (none)
The Qualifed constructor create an empty qualified name object which evaluates
to nil.
Qualified (String)
The Qualified constructor create a qualified name object using the string
argument as the qualified name. The name is parse for qualified name syntax
adherence.
Methods
map -> Object (none)
The map method returns the object that is mapped by the qualified name. Most of
the time, a symbol object is returned since it is the kind of object stored in
a nameset. Eventually the mapping might returns an argument object if used
inside a closure.
Symbol
symbol-p
Inheritance
Literal
Constructors
Symbol (String)
The Symbol constructor create a symbol by name. The associated object is marked
as nil.
Symbol (String Object)
The Symbol constructor create a symbol by name and bind the object argument to
the symbol.
Methods
get-const -> Boolean (none)
The get-const method returns the symbol const flag. If the flag is true, the
symbol object cannot be changed unless that flags is reset with the set-const
method.
set-const -> none (Boolean)
The set-const method set the symbol const flag. This method is useful to mark a
symbol as const or to make a const symbol mutable.
get-object -> Object (none)
The get-object method returns the symbol object.
set-object -> none (Object)
The set-object method set the symbol object. The object can be obtained by
evaluating the symbol.
Closure
closure-p
Inheritance
Object
Constructors
Closure (none)
The Closure constructor create a default closure. When the closure is created, a
local set of arguments and closed variables is generated. Note that such local
set is dynamic. There is no restriction to reconfigure a particular lambda at
run-time. The difference between a lambda and a gamma expression resides in
the nameset binding when the closure is called. With a lambda, the closure
nameset parent is the calling nameset. With a gamma expression, the parent
nameset is always the top-level interpreter nameset. Note also, that the
symbol self is automatically bounded for this closure.
Closure (Boolean)
The Closure constructor create a closure which acts as lambda expression if the
boolean argument is true. If the boolean argument is false, the closure will
behave like a gamma expression.
Methods
gamma-p -> Boolean (none)
The gamma-p predicate returns true if the closure is a gamma expression. The
predicate returns true for a lambda expression.
lambda-p -> Boolean (none)
The lambda-p predicate returns true if the closure is a lambda expression. The
predicate returns false for a gamma expression.
get-form -> Object (none)
The get-form method returns the closure form object.
set-form -> none (Object)
The set-form method sets the closure form object.
add-argument -> none (String|Lexical|form)
The add-argument method adds an argument to the closure. The argument object can
be either a string, a lexical object of a simple form that defines a constant
lexical name.
Librarian
librarian-p
Inheritance
Nameable
Constructors
Librarian (none)
The Librarian constructor creates a librarian for writing. Initially, the
librarian is empty and files must be added with the add method.
Librarian (String)
The Librarian constructor creates a librarian for reading using the name as the
librarian file name.
Methods
add -> none (String)
The add method adds a file into the librarian. The librarian must have been
opened in write mode.
write -> none (String)
The write method writes a librarian to a file those name is the argument.
length -> Integer (none)
The length method returns the number of file in the librarian. This method work,
no matter how the librarian has been opened.
exists-p -> Boolean (String)
The exists-p predicate returns true if the file argument exists in the
librarian.
extract -> InputMapped (String)
The extract method returns an input stream mapped to the file name
argument.
Resolver
resolver-p
Inheritance
Object
Constructors
Resolver (none)
The Resolver constructor creates a default resolver. Once created, the add
method can be used to add path to the resolver.
Methods
add -> none (String)
The add method adds a path into the resolver. The path can points either to a
directory or a librarian.
lookup -> InputStream (String)
The lookup method resolves the file name argument and returns an input stream
for that file.
valid-p -> Boolean (String)
The valid-p predicate returns true if the file name argument can be resolved. If
the file name can be resolved, the lookup method can be called to get an input
stream.
PrintTable
print-table-p
Inheritance
Object
Constructors
PrintTable (none)
The PrintTable constructor creates a default table with one column.
PrintTable (Integer)
The PrintTable constructor creates a table with a pre-defined number of columns
specified in the constructor argument.
PrintTable (Integer Integer)
The PrintTable constructor creates a table with a pre-defined number of columns
and rows specified in the constructor arguments.
Methods
head-p -> Boolean (none)
The head-p predicate returns true if the table header is defined.
add-head -> none ([String+])
The add-head method add to the table header the string arguments. The number of
arguments must be equal to the number of columns.
get-head -> String (Integer)
The get-head method returns a table header element by column index. The integer
argument is the header row index.
set-head -> none (Integer String)
The set-head method sets a table header element by column index. The first
argument is the header column index and the second is the header string value
to set.
add -> Integer (none|[Literal...])
The add method serves several purposes. Without argument, a new row is added and
the row index is returned. The row index can be later used with the set method
to set a particular table element. With one or several literal arguments,
those length must match the number of columns, a new row is created and those
arguments added to the table. The row number is also returned.
get -> String (Integer Integer)
The get method returns a particular table element by row and column. The first
argument is the table row index and the second is the table column
index.
set -> none (Integer Integer Literal)
The set method sets a particular table element by row and column. The first
argument is the table row index and the second is the table column index. The
last argument is a literal object that is converted to a string prior its
insertion.
tag-p -> Boolean (Integer Integer)
The tag-p predicate returns true if a tag is present at a particular table
element. The first argument is the table row index and the second is the table
column index.
set-tag -> none (Integer Integer String)
The set-tag method sets a particular table tag by row and column. The first
argument is the table row index and the second is the table column index. The
last argument is the tag value.
get-tag -> String (Integer Integer)
The get-tag method returns a particular table tag by row and column. The first
argument is the table row index and the second is the table column
index.
dump -> none|String
(none|Integer|OutputStream|Buffer)
The dump method dumps the table to an output stream or a buffer. Without
argument, the default interpreter output stream is used. With an integer
argument, the specified row is used and a string is returned. With a buffer or
an output stream, the whole table is written and nothing is returned.
format -> none|String
(none|Integer|OutputStream|Buffer)
The format method writes the formatted table to an output stream or a buffer.
Without argument, the default interpreter output stream is used. With an
integer argument, the specified row is used and a string is returned. With a
buffer or an output stream, the whole table is written and nothing is
returned.
get-rows -> Integer (none)
The get-rows method returns the number of rows in the table.
get-columns -> Integer (none)
The get-columns method returns the number of columns in the table.
set-column-size -> none (Integer Integer)
The set-column-size method sets the desired width for a particular column. The
first argument is the column index and the second argument is the column
width.If 0 is given, the column width is computed as the maximum of the column
elements.
get-column-size -> Integer (Integer)
The get-column-size method returns the desired width for a particular
column.
set-column-fill -> none (Integer Character)
The set-column-fill method sets the filling character for a particular column.
The first argument is the column index and the second argument is a character
to use when filling a particular column element. The default filling character
is the blank character.
get-column-fill -> Character (Integer)
The get-column-fill method returns the filling character for a particular
column.
set-column-direction -> none (Integer Boolean)
The set-column-direction method sets the direction flag for a particular column.
The first argument is the column index and the second argument is a boolean. A
false value indicates a filling by the left while a true value indicates a
filling by the right. The column filling character is used for this
operation.
get-column-direction -> Boolean (Integer)
The get-column-direction method returns the direction flag for a particular
column.
Logger
logger-p
Inheritance
Object
Constructors
Logger (none)
The Logger constructor creates a default logger.
Logger (Integer)
The Logger constructor creates a logger with a specific size specified as the
constructor argument.
Logger (String)
The Logger constructor creates a logger with an information argument. The
information string is later used to format the logged messages.
Logger (Integer String)
The Logger constructor creates a logger with a specific size and an information
argument. The first argument is the logger size. The second argument is the
information string. The information string is later used to format the logged
messages.
Methods
add -> none (String|String Integer)
The add method adds a message in the logger. With one argument, the method take
a single string message. with two arguments, the first arguments is the
message and the second argument is the message level.
reset -> none (none)
The reset method reset the logger class by removing all messages.
length -> Integer (none)
The length method returns the number of messages stored in the logger
object.
resize -> none (Integer)
The resize method resize the logger class by increasing the size of the message
buffer. The old messages are kept during the resizing operation.
set-info -> none (String)
The set-info method sets the logger information string. The information string
is used by the derived classes when a message is printed.
get-info -> String (none)
The get-info method returns the logger information string. The information
string is used by the derived classes when a message is printed.
set-default-level -> none (Integer)
The set-default-level method sets the default level use for storing message.
This parameter is used with the add method in conjunction with the message
argument. When the message level is specified, the default message level is
ignored.
get-default-level -> Integer (none)
The get-default-level method returns the default message level used by the
logger. The default message level is used by the add method when the message
level is not specified directly.
get-message -> String (Integer)
The get-message method returns a logger message by index. The integer argument
is the message index.
get-full-message -> String (Integer)
The get-full-message method returns a fully formatted logger message by index.
The integer argument is the message index. The message includes the time and
contents.
get-message-time -> Integer (Integer)
The get-message-time method returns the logger message time by index. The
integer argument is the message index.
get-message-level -> Integer (Integer)
The get-message-level method returns the logger message level by index. The
integer argument is the message index.
set-output-stream -> none (OutputStream|String)
The set-output-stream method set the logger output stream. The output stream can
be either an output stream or an output file name.
Counter
counter-p
Inheritance
Literal
Constructors
Counter (none)
The Counter constructor creates a default counter. Since, both start and end
values are initialized to 0, this object will never count.
Counter (Integer)
The Counter constructor creates an upward counter. If the argument value, the
initial counter value is the argument value and the counter will counter from
the value to 0. If the argument value is positive, the final counter value is
the argument value and the counter will count from 0 to this value.
Counter (Integer Integer)
The Counter constructor creates a counter with an initial and final values.
Depending on the initial and final value the counter might be an upward or a
downward counter.
Methods
reset -> none (none)
The reset method reset the counter to its start value.
step-p -> Boolean (none)
The step-p predicate checks if the counter can be moved by one position. If the
test is successful, the counter is moved upward or downward. the method
returns the result of the test.
valid-p -> Boolean (none)
The valid-p predicate returns true if the counter can be moved by one
position.
Lexer
lexer-p
Inheritance
Object
Methods
get-token -> Token (none)
The get-token method returns the next available token.
get-object -> Object (none)
The get-object method returns the next available object.
get-line-number -> Integer (none)
The get-line-number method returns the token line number which is the current
line number under processing.
Former
former-p
Inheritance
Object
Methods
parse -> Form (none)
The parse method returns the next available form.
get-line-number -> Integer (none)
The get-line-number method returns the form line number which is the current
line number under processing.
Reader
reader-p
Inheritance
FormerNameable
Constructors
Reader (none)
The Reader constructor creates a default reader.
Reader (String|InputStream)
The Reader constructor creates a reader by string or input stream. In the first
form, a string is mapped into a string stream which is used by the reader to
parse form. In the second form, an input stream is bound to the reader to
parse forms.
Loader
loader-p
Inheritance
Object
Methods
length -> Integer (none)
The length method returns the number of loaded libraries.
get -> Library (Integer)
The get method returns a library object by index.
exists-p -> Boolean (String)
The exists-p predicate returns true if a library is already loaded in the
interpreter.
2012-03-26 | AFNIX |