STD-US-NORMS(7)
๐ STD-US-NORMS(7) ๐
Miscellaneous Information Manual but make it a group chat. The manual name is std-us-norms, and it is literally the afnix reference manual. ๐
๐ NAME ๐
std-us-norms โ afnix reference manual
๐ RESERVED KEYWORDS ๐
okay so reserved keywords are, together with symbols and literals, the basic constituents of the writing system. With a couple of exceptions, reserved keywords are actually special forms. During the execution, a special
bestie, the manpage really just stops mid-sentence there. I am not kidding. ๐
๐ assert ๐
The assert special form is checking for equality between two operands. Both objects must be of the same type. If the equality test fails, the special form prints a message and aborts the execution. You can also pass an optional boolean to disable exact compare. This is useful for real number assertion where an approximate comparison is needed. By default, the assertion checking is turned off. The interpreter option -f assert enables the assertion checking. When the interpreter is compiled in debug mode, the assertion checking is turned on by default. So if you're in debug mode, it's already on. Periodt.
๐ Syntax
assert "form 1" "form 2" assert "form 1" "form 2" "exact compare"
๐ Example
assert true (== 1 1) assert 3 (+ 2 1) assert 1.234567
1.234568 false
๐งฑ block ๐งฑ
The block special form defines a new nameset for sequential execution of regular form or implicit form. When the block form is evaluated, the block nameset is linked to its parent nameset. When all forms have been executed, the block nameset is destroyed, and the result of the last evaluation in the block is considered to be the result of the block evaluation. It's giving mini-scope moment, and we are obsessed. โจ
๐ Syntax
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 ๐จ
The class special form creates a new class object. Without argument, an instance of that class is created without data members. That's it. Simple. Iconic.
๐ Syntax
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 ๐
The const special form binds a symbol with an object and marks it as a constant symbol. When used with three or four argument, a gamma expression is automatically created. const can also be used to bind class or instance members. So yeah, it's the "this is permanent" button. ๐
๐ Syntax
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 โณ
The delay special form delays the evaluation of the form argument by creating a Promise object. The promise evaluates to itself until a call to force the evaluation has been made. When the promise has been forced, the evaluation result is stored. Further call to force will produce the same result. Without argument, the delayed evaluation is nil. With one argument, a Promise object is created directly. With several argument, a cons cell is created with the first argument left unevaluated and the other evaluated. This permits you to delay a form while evaluating the calling arguments. It's literally the "I'll do it later" special form. ๐
๐ Syntax
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 ๐
The do special form is used to build loop with forward condition. The loop construct accepts either 2 or 3 arguments. With 2 argument, the first argument is the loop body and the second argument is the loop condition which must evaluates to a boolean object. With 3 arguments, the first argument is the initial condition that is executed only once. Forward condition loops? We love a little pre-check moment. ๐ฅ
๐ Syntax
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 ๐ข
The enum special form creates an enumeration from a list of literal. The result object is an Enum object that holds the enumerated items. An item evaluation results with an Item object that is bound to the enumeration object. Cute little named list vibe. ๐
๐ Syntax
enum "literal" ...
๐ Example
const e (enum E1 E2 E3)
๐จ errorln ๐จ
The errorln special form prints on the interpreter error stream a set of arguments. Each arguments have to be a literal which are converted to a string. When all arguments have been printed a new line character is printed. The error special form behaves like errorln except that a new line character is not printed at the end of the arguments. So errorln is the one with the dramatic newline. ๐ญ
๐ Syntax
errorln errorln "nil" errorln "literal list"
๐ Example
errorln errorln "hello millennium" ' ' 2000
๐ง eval ๐ง
The eval special form simply evaluates the object argument. The form is useful when returning an argument from a lambda or gamma expression using an implicit form. Just evaluate it, bestie. โจ
๐ Syntax
eval "object"
๐ Example
const ret (x) (eval x) eval (protect (+ 1 2))
๐ for ๐
The for special form provides a facility to iterate on iterable objects. The Cons, List and Vector objects are typical iterable objects. For each iterable objects, a symbol is set after each iteration. Each object symbol value can be used for further computation. The iteration stops when one of the objects iterator is at the end position. It's giving loop-de-loop energy. ๐
๐ Syntax
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 ๐ช
The force special form forces the evaluation of its argument. If the argument evaluates to a promise object, the promise evaluation is forced. If the argument is not a promise, force keyword behaves like eval. When a promise has been forced, further call to force will not change the evaluation result. So it's the "okay I'm actually doing it now" button. ๐ช
๐ Syntax
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 โ
The if special form executes a form based on the evaluation of a boolean expression. In its first representation, if executes a form if the condition is evaluated to true. An alternate form can be specified and is executed if the boolean expression evaluates to false. It is an error to use a conditional form which does not evaluate to a boolean object. Choose your own adventure, but it must be a boolean object, no cap. ๐
๐ Syntax
if "condition" "true form" if "condition" "true form" "else form"
๐ Example
const max (x y) (if (> x y) x y)
๐งฌ lambda ๐งฌ
The lambda special form creates a new closure object with eventually a set of arguments and a set of closed variables. In its first form, the closure is declared with a set of arguments or nil to indicate no argument. In its second form, the closure is declared with a set of arguments and a set of closed variables. The closed variables are evaluated at the construction of the closure and become part of the closure object. When the closure is called, a new nameset is created and linked with the parent nameset. The set of calling arguments are bounded in that nameset with the formal argument list to become the actual arguments. The set of closed variables is linked at runtime to the closure nameset. A lambda or gamma expression can have its argument declared as const argument. Closure? In this economy? Yes bestie. ๐งฌ
๐ Syntax
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 ๐
The launch special form creates a new thread by executing the form argument in a normal thread. The created thread is added in the normal thread list by creating a clone of the interpreter and starting immediately the execution of the form with the cloned interpreter. The command returns the thread object in the calling thread. When the thread terminates, the thread object holds the result of the last executed form. The main thread is suspended until all normal threads have completed their execution. Thread go brrr, and the main thread waits. ๐ฆ
๐ Syntax
launch "form" launch "thread" "form"
๐ Example
launch (println "hello world")
๐ loop ๐
The loop special form executes a loop based on an initial condition, an exit condition and a step form. The initial condition is only executed one time. The exit condition is tested at each loop iteration. The loop special form creates its own nameset since the initial condition generally binds symbol locally for the loop. A classic three-part loop, but make it nameset-aware. ๐
๐ Syntax
loop "init form" "exit form" "step" "form"
๐ Example
loop (trans i 0) (< i 10) (i:++) (println i)
๐๏ธ nameset ๐๏ธ
The nameset special form creates a new nameset. With no argument, a new nameset is created and no parent is bound to this nameset. With one argument, the argument must evaluate to a nameset and that nameset is used as the parent one. If a nameset has to be created with the global nameset as the parent, the symbol ... can be used to reference the top level nameset. The symbol . references the current nameset. The symbol .. references the parent nameset of the current nameset. Nameset lore, iykyk. ๐๏ธ
๐ Syntax
nameset nameset "parent nameset"
๐ Example
const local-nameset-not-bound (nameset) const local-nameset-
bounded (nameset ...) const ...:global-nameset (nameset)
๐จ๏ธ println ๐จ๏ธ
The println special form prints on the interpreter output stream a set of arguments. Each arguments have to be a literal which is converted to a string. When all arguments have been printed a new line character is printed. The print special form behaves like println except that a new line character is not printed at the end of the arguments. So println is the one that hits enter for you. ๐จ๏ธ
๐ Syntax
println println "nil" println "literal list"
๐ Example
println println "hello millennium" ' ' 2000
๐ก๏ธ protect ๐ก๏ธ
The protect special form take a single argument and returns it without evaluation. Protect is mainly use to get a symbol or form object. No evaluation, just vibes. ๐ก๏ธ
๐ Syntax
protect "object"
๐ Example
const cons (protect (+ 1 2))
return
okay bestie, the return special form is the "we're done here" button ๐
it makes the current expression stop evaluating and hands back the argument โ or nil if you gave it nothing. You'll mostly see it inside lambda or gamma expressions. But if you drop it in a top level block? The block execution just stops and control gets yeeted back to the top level. slay.
Syntax
return "object"
Example
return (+ 1 2)
break
the break special form also stops the current expression from evaluating and returns the argument or nil. Its main character moment is inside loops, where the loop result gets evaluated by the breaking expression. Outside of a loop, break behaves like return (yes, it's giving undercover agent ๐ต๏ธ).
Syntax
break "object"
Example
break (+ 1 2)
continue
continue is the special form that stops the current expression's evaluation and returns the argument or nil โ same energy as the others. It's primarily used in loops, where the loop restarts at the point of evaluation ๐. Outside of a loop, break will behaves like return. (that's what the page says, bestie, I'm just the messenger ๐ญ)
Syntax
continue "object"
Example
continue (+ 1 2)
sync
sync is a form synchronizer, and ngl it's kind of iconic ๐ In a multi-threaded environment, the engine guarantees that only one thread will execute the form. Every other thread gets suspended until that form is completed. one at a time, no fighting, periodt.
Syntax
sync "form"
Example
const print-message (code mesg) (
sync {
errorln "error : " code
errorln "message: " mesg
} )
switch
switch is a form selector โ the vibe check of control flow โจ The first argument is the object you're switching on. The second argument is a list of forms, each with an object matcher plus an execution form. And the else special form can be used as the default matcher. iykyk.
Syntax
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
throw is the special form that throws an exception ๐จ Here's the rundown:
- No argument โ an exception of type
user-exceptionis thrown. - One argument โ the exception id is set.
- Two arguments โ the exception id and exception reason are set.
- Three arguments โ the exception id, exception reason and exception object are set.
An exception object represented by the symbol what can also be thrown โ that's the method used to re-throw an exception. so dramatic, I love it ๐
Syntax
throw throw what throw "id" throw "id" "reason" throw "id"
"reason" "object"
Example
throw throw "type-error" throw "type-error" "invalid argument"
trans
The trans special form creates or sets a symbol with an object. It searches in the current nameset only โ no wandering off ๐ If the symbol is found, it gets set with the object. If it's not found, it gets created in the current nameset. trans can also be used with qualified names. And with 3 or 4 arguments, trans automatically creates a lambda expression. multitasking queen โจ
Syntax
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
The try special form catches an exception in the current execution nameset ๐ฅ
The first argument is a form to execute. The optional second argument is the exception handler that gets called in case of exception. If there's no exception handler, all exceptions are caught.
The result of execution is one of:
- the result of the form execution,
- the exception object in case of exception,
- or
nilif the exception is a native one.
If there is an exception handler, the handler is executed with a new nameset, and the special symbol what is bound to the exception. If the exception is nil, the symbol what is undefined.
Syntax
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
The unref special form unreference a symbol. short, sweet, to the point ๐
Syntax
unref symbol
Example
const number 123 unref number
while
while is the special form you use to build a loop with a backward condition ๐ The loop construct accepts either 2 or 3 arguments:
- With 2 arguments, the first argument is the loop condition and the second is the loop body, which must evaluate to a boolean.
- With 3 arguments, the first argument is the initial condition, which is executed only once.
Syntax
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 }
๐ซถ RESERVED OBJECTS ๐ซถ
This chapter is a whole reference of the reserved objects and their respective builtin methods ๐ The reserved objects are those objects defined in the global interpreter nameset and bound as reserved names. Every literal has a string representation, and the to-string method is always available for these reserved objects. A literal object also has a default constructor โ and generally, it can be constructed by a same type object or by a string object too.
โจ Literal โจ
The Literal object is a base object for all literal objects. Its sole purpose? Providing two methods named to-string and to-literal that return a string representation of the literal object. that's it, that's the job ๐
Predicate
literal-p
Inheritance
Serial
Methods
to-string -> String (none)โ returns a string representation of the literal. The string is expected to represent the literal at its best โจto-literal -> String (none)โ also returns a string representation of the literal, but the string differs fromto-stringin that it's a literal representation. Example: the literal representation of a string is the quoted string. cute, right?
โจ Nameable โจ
The Nameable object is a base object that supports name definition. Its sole purpose is to provide a method named get-name that returns the object name ๐ท๏ธ
Predicate
nameable-p
Inheritance
Object
Methods
get-name -> String (none)โ returns the associated object name. The object name defined here is a name that the class wishes to associate with the object. For example,InputFileis a nameable class and the name is the file name ๐
โจ Collectable โจ
The Collectable object is a base object designed to provide the methods for collectable objects ๐๏ธ Collectable objects are special objects that can be controlled by a special memory manager, called a memory collector or garbage collector. Unlike a simple object associated with a reference count, the collectable object is also controlled by special methods. In particular, the release method can be invoked to release all internal links susceptible to creating loops โ which would otherwise prevent the object from being released by the standard reference count mechanism. Heads up though: releasing a link does not necessarily result in the object destruction. important!!
Predicate
collectable-p
Inheritance
Object
Methods
release -> none (none)โ releases all links associated with the object. This method is naturally used to break circular dependencies, which prohibit the normal object destruction by the means of reference counting ๐๐ฅ
โจ Item โจ
The Item reserved object is an enumeration item ๐๏ธ The item is bound to an enumeration object. An item object is created during the evaluation of an enumeration object โ and an enumeration item cannot be constructed directly. no DIY, bestie ๐
Predicate
item-p
Inheritance
Literal
Operators
== -> Boolean (Boolean)โ returnstrueif the calling object is equal to the boolean argument.!= -> Boolean (Boolean)โ the==operator returnstrueif the calling object is not equal to the boolean argument. (yes, the page says==there โ I'm keeping it exactly as-is, no cap ๐ญ)
Methods
get-enum -> Enum (none)โ returns the enumeration object bound to the item. The item must be a dynamic item or an exception is thrown ๐จ
โจ Boolean โจ
The Boolean reserved object implements the behavior of a native boolean type. Two builtin symbols, namely true and false, represent the value of a boolean instance. The Boolean type is primarily used for test expressions โ
โ
Predicate
boolean-p
Inheritance
Literal
Constructors
Boolean (none)โ creates a boolean object whose default value isfalse.Boolean (Boolean)โ creates a boolean object with the boolean object argument.Boolean (String)โ creates 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)โ returnstrueif the calling object is equal to the boolean argument.!= -> Boolean (Boolean)โ the==operator returnstrueif the calling object is not equal to the boolean argument. (same energy as before, keeping it verbatim ๐ซถ)
โจ Number โจ
The Number reserved object is a base class for all number objects ๐ข The number base object is used by the Integer, Real and Relatif objects. The class provides essentially the methods needed to format a number.
Predicate
number-p
Inheritance
Literal
Methods
format -> String (none|Integer)โ formats the calling number instance with a certain number of digits after the decimal point. In the first form, without argument, the default formatting representation is performed with a null precision. In the second form, a number is represented with a certain precision given by the calling argument โจto-hexa -> String (none)โ returns a signed hexadecimal representation of a number. This method works well withIntegerandRelatifobjects ๐to-hexa-string -> String (none)โ returns a hex representation of a number, no prefix attached. The number is always treated as positive no matter what. This one plays super nice withIntegerandRelatifobjects. ๐
โจ Integer โจ
okay bestie, the Integer reserved object is giving native 64-bit signed integer energy โ it literally implements that behavior. You build one from a literal using standard decimal notation, and you can also construct one from a string. All the standard operators come with it, no extra charge. Integer is a literal object derived from the Number object. ๐
๐ Predicate
integer-pโ the vibe check for "is this an Integer?" ๐ฆ
๐ธ Inheritance
Number
๐ Constructors
Integer (none)โ makes an integer object whose default value is0.Integer (Real)โ makes an integer object from the real object argument, with that value truncated down to an integer value.Integer (Integer)โ makes an integer object from the integer object argument.Integer (Character)โ makes an integer object from the character object argument. The character encoding value gets used as the integer value.
๐ Operators
== -> Boolean (Integer|Real)โ returnstrueif the calling object equals the integer or real argument.!= -> Boolean (Integer|Real)โ returnstrueif the calling object is not equal to the integer or real argument.+ -> Integer (Integer|Real)โ returns the sum of the calling integer and an integer or real object.- -> Integer (Integer|Real)โ returns the subtraction of the calling integer and an integer or real object.* -> Integer (Integer|Real)โ returns the multiplication of the calling integer and an integer or real object./ -> Integer (Integer|Real)โ returns the division of the calling integer and an integer or real object.< -> Boolean (Integer|Real)โ returnstrueif the calling integer is less than the integer or real object.<= -> Boolean (Integer|Real)โ returnstrueif the calling integer is less equal than the integer or real object.> -> Boolean (Integer|Real)โ returnstrueif the calling integer is greater than the integer or real object.>= -> Boolean (Integer|Real)โ returnstrueif the calling integer is greater equal than the integer or real object.++ -> Integer (Integer|Real)โ increments the calling integer by1. lil glow-up โจ-- -> Integer (Integer|Real)โ decrements the calling integer by1.+= -> Integer (Integer|Real)โ adds and assigns the calling integer with an integer or real argument object.-= -> Integer (Integer|Real)โ subtracts and assigns the calling integer with an integer or real argument object.*= -> Integer (Integer|Real)โ multiplies and assigns the calling integer with an integer or real argument object./= -> Integer (Integer|Real)โ divides and assigns the calling integer with an integer or real argument object.
๐ Methods
or -> Integer (Integer)โ returns the binary or between the integer and the integer argument.abs -> Integer (none)โ returns the absolute value of the calling integer instance. no more negativity ๐not -> Integer (none)โ returns the binary negation of the calling integer instance.shl -> Integer (Integer)โ returns a new integer, the calling integer instance shifted left by the integer argument.shr -> Integer (Integer)โ returns a new integer, the calling integer instance shifted right by the integer argument.and -> Integer (Integer)โ returns a new integer, the binary and between the calling integer instance and the integer argument.xor -> Integer (Integer)โ returns a new integer, the binary xor between the calling integer instance and the integer argument.mod -> Integer (Integer)โ returns the modulo between the integer instance and the integer argument. Heads up: a type-error exception is raised if the argument is not an argument. ๐ซ (yes, that's literally what it says, iykyk)odd-p -> Boolean (none)โ returnstrueif the integer instance is odd,falseotherwise.even-p -> Boolean (none)โ returnstrueif the integer instance is even,falseotherwise.zero-p -> Boolean (none)โ returnstrueif the integer instance is null,falseotherwise.
๐ Relatif ๐
The Relatif reserved object is the unlimited signed integer queen โ it implements that behavior, no ceiling, no cap fr fr. To build one from a literal you use standard decimal notation followed by the 'r' or 'R' character. You can also construct one from a string. This class is basically the Integer class's cooler sibling. Relatif is a literal object derived from the Number object. ๐
๐ง Predicate
relatif-pโ the vibe check for "is this a Relatif?" ๐ฆ
๐ธ Inheritance
Number
๐ Constructors
Relatif (none)โ makes a relatif object whose default value is0.Relatif (Real)โ makes a relatif object from the real object argument, with that value truncated down to an integer value.Relatif (Relatif)โ makes a relatif object from the relatif object argument.Relatif (Integer)โ makes a relatif object from the integer object argument.Relatif (Character)โ makes a relatif object from the character object argument. The character encoding value gets used as the relatif value.
๐ Operators
== -> Boolean (Relatif|Integer)โ returnstrueif the calling object equals the relatif or integer argument.!= -> Boolean (Relatif|Integer)โ returnstrueif the calling object is not equal to the relatif or integer argument. (lowkey the manpage prints==on this line, but it's the!=entry, promise ๐)+ -> Relatif (Relatif|Integer)โ returns the sum of the calling relatif and a relatif or integer object.- -> Relatif (Relatif|Integer)โ returns the subtraction of the calling relatif and a relatif or integer object.* -> Relatif (Relatif|Integer)โ returns the multiplication of the calling relatif and a relatif or integer object./ -> Relatif (Relatif|Integer)โ returns the division of the calling relatif and a relatif or integer object.< -> Boolean (Relatif|Integer)โ returnstrueif the calling relatif is less than the relatif or integer object.<= -> Boolean (Relatif|Integer)โ returnstrueif the calling relatif is less equal than the relatif or integer object.> -> Boolean (Relatif|Integer)โ returnstrueif the calling relatif is greater than the relatif or integer object.>= -> Boolean (Relatif|Integer)โ returnstrueif the calling relatif is greater equal than the relatif or integer object.++ -> Relatif (Relatif|Integer)โ increments the calling relatif by1.-- -> Relatif (Relatif|Integer)โ decrements the calling relatif by1.+= -> Relatif (Relatif|Integer)โ adds and assigns the calling relatif with a relatif or integer argument object.-= -> Relatif (Relatif|Integer)โ subtracts and assigns the calling relatif with a relatif or integer argument object.*= -> Relatif (Relatif|Integer)โ multiplies and assigns the calling relatif with a relatif or integer argument object./= -> Relatif (Relatif|Integer)โ divides and assigns the calling relatif with a relatif or integer argument object.
๐ Methods
or -> Relatif (Relatif)โ returns the binary or between the relatif and the relatif argument.abs -> Relatif (none)โ returns the absolute value of the calling relatif instance.not -> Relatif (none)โ returns the binary negation of the calling relatif instance.shl -> Relatif (Integer)โ returns a new relatif, the calling relatif instance shifted left by the integer argument.shr -> Relatif (Integer)โ returns a new relatif, the calling relatif instance shifted right by the integer argument.pow -> Relatif (Integer|Relatif|Integer Integer|Relatif Relatif)โ returns a new relatif corresponding to the power of the calling relatif instance raised to the integer or relatif argument. With one argument, the power is computed directly. With two arguments, a fast modular exponentiation is performed, using the second argument as the modulus. iconic math behavior honestly ๐ฅmmi -> Relatif (Integer|Relatif)โ returns the multiplicative modular inverse of the calling relatif. The argument is the modulus used for the inverse calculation.and -> Relatif (Relatif)โ returns a new relatif, the binary and between the calling relatif instance and the relatif argument.xor -> Relatif (Relatif)โ returns a new relatif, the binary xor between the calling relatif instance and the relatif argument.mod -> Relatif (Relatif|Integer)โ the mod method hands you the modulo of the relatif instance and whatever relatif-or-integer you threw at it. Pass it something invalid and boom, type-error exception โ it will not play about that. ๐ โ๏ธodd-p -> Boolean (none)โ returnstrueif the relatif instance is odd,falseif it's not. that's it. that's the method. โจeven-p -> Boolean (none)โ returnstrueif the relatif instance is even,falseotherwise. bestie behavior fr fr.zero-p -> Boolean (none)โ returnstrueif the relatif instance is null,falseotherwise. the vibe check for zero. ๐get-msb -> Integer (none)โ returns the most significant bit position for the calling relatif. if the number is null,0gets returned. and heads up: the msb position is counted from1. ๐ข
๐ฆ Real ๐ฆ
The Real reserved object is literally the whole personality of a double floating point number type. you build a real object from a literal using standard decimal dot notation or scientific notation โ both ate, no notes. ๐ you can also construct one from an integer, a character or a string. and plot twist: the Real object is a literal object derived from the Number object. generational. ๐
Predicate
real-p
Inheritance
Number
Constructors
Real (none)โ creates a real object whose default value is0.0. a fresh baby real. ๐Real (Real)โ creates a real object from the real object argument you pass in.Real (Integer)โ creates a real object from the integer object argument.Real (Character)โ creates a real object from the character object argument, and the character's encoding value gets used as the integer value. iykyk. ๐ฆ
Operators
== -> Boolean (Integer|Real)โ returnstrueif the calling object is equal to the integer or real argument.!= -> Boolean (Integer|Real)โ returnstrueif the calling object is not equal to the integer or real argument. (yes the source text says==on this line and we are keeping it exactly as-is โ we don't edit, we just report ๐ซก๐)+ -> Real (Integer|Real)โ returns the sum of the calling real and an integer or a real object. adding, slaying. โ- -> Real (Integer|Real)โ returns the subtraction of the calling real with an integer or a real object.* -> Real (Integer|Real)โ returns the multiplication of the calling real with an integer or a real object./ -> Real (Integer|Real)โ returns the division of the calling real with an integer or a real object.< -> Boolean (Integer|Real)โ returnstrueif the calling real is less than the integer or real object.<= -> Boolean (Integer|Real)โ returnstrueif the calling real is less equal than the integer or real object.> -> Boolean (Integer|Real)โ returnstrueif the calling real is greater than the integer or real object.>= -> Boolean (Integer|Real)โ returnstrueif the calling real is greater equal than the integer or real object.++ -> Real (Integer|Real)โ increments the calling real by1. glow up by one. โจ-- -> Real (Integer|Real)โ decrements the calling real by1.+= -> Real (Integer|Real)โ add and assign the calling real with an integer or real argument object.-= -> Real (Integer|Real)โ subtracts and assign the calling real with an integer or real argument object.*= -> Real (Integer|Real)โ multiply and assign the calling real with an integer or real argument object./= -> Real (Integer|Real)โ divide and assign the calling real with an integer or real argument object. (the line in the source says+=here โ again, not touching it, just showing you exactly what's on the page ๐ซถ)
Methods
nan-p -> Boolean (none)โ returnstrueif the calling real number instance is not-a-number (nan). the iconic identity crisis method. ๐ญceiling -> Real (none)โ returns the ceiling of the calling real number instance. rounding up, main character energy. โฌ๏ธfloor -> Real (none)โ returns the floor of the calling real number instance. rounding down, humble era. โฌ๏ธabs -> Real (none)โ returns the absolute value of the calling real number instance.pow -> Real (Real|Integer)โ 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)โ returns the square root of the calling real number instance. ๐งln -> Real (none)โ returns the natural logarithm of the calling real number instance.exp -> Real (none)โ returns the exponential of the calling real number instance.sin -> Real (none)โ returns the sine of the calling floating point instance. the angle is expressed in radian.cos -> Real (none)โ returns the cosine of the calling floating point instance. the angle is expressed in radian.tan -> Real (none)โ returns the tangent of the calling floating point instance. the angle is expressed in radian.asin -> Real (none)โ returns the arc sine of the calling floating point instance. the result is in radian.acos -> Real (none)โ returns the arc cosine of the calling floating point instance. the result is in radian.atan -> Real (none)โ returns the arc tangent of the calling floating point instance. the result is in radian.sinh -> Real (none)โ returns the hyperbolic sine of the calling real number instance.cosh -> Real (none)โ returns the hyperbolic cosine of the calling real number instance.tanh -> Real (none)โ returns the hyperbolic tangent of the calling real number instance. (source saysatanon this line, we're keeping the receipts ๐งพ๐)asinh -> Real (none)โ returns the hyperbolic arc sine of the calling real number instance.acosh -> Real (none)โ returns the hyperbolic arc cosine of the calling real number instance.atanh -> Real (none)โ returns the hyperbolic arc tangent of the calling real number instance.zero-p -> Boolean (none)โ returnstrueif the calling real instance is null,falseotherwise.
๐ Complex ๐
The Complex reserved object is doing the whole double floating point complex type thing. you construct a complex object from a literal using standard decimal dot notation or scientific notation, with the letter i as the postfix for the imaginary part โ yes, the imaginary part gets a little i accessory and honestly? iconic. ๐ the Complex object is a literal object derived from the Number object, same family tree as Real. ๐
Predicate
complex-p
Inheritance
Number
Constructors
Complex (none)โ creates a complex object whose default value is0.0+0.0i. brand new, zero thoughts, zero imagination (literally). ๐Complex (Complex)โ creates a complex object from the complex object argument.Complex (Real)โ creates a complex object from the real object argument.Complex (Integer)โ creates a complex object from the integer object argument.
Operators
== -> Boolean (Integer|Real|Complex)โ returnstrueif the calling object is equal to the integer, real or complex argument.!= -> Boolean (Integer|Real|Complex)โ returnstrueif the calling object is not equal to the integer, real or complex argument. (source says==here again โ keeping it verbatim, bestie, no cap ๐ซก)+ -> Real (Integer|Real|Complex)โ returns the sum of the calling complex with an integer, a real or complex object.- -> Real (Integer|Real|Complex)โ returns the subtraction of the calling complex with an integer, real or complex object.* -> Real (Integer|Real|Complex)โ returns the multiplication of the calling complex with an integer, real or complex object./ -> Real (Integer|Real|Complex)โ returns the division of the calling complex with an integer, real or complex object.+= -> Real (Integer|Real|Complex)โ add and assign the calling complex with an integer, real or complex argument object.-= -> Real (Integer|Real|Complex)โ subtracts and assign the calling complex with an integer, real or complex argument object.*= -> Real (Integer|Real|Complex)โ multiply and assign the calling complex with an integer, real or complex argument object./= -> Real (Integer|Real|Complex)โ divide and assign the calling complex with an integer, real or complex argument object. (yep,+=again in the source line โ showing you exactly what's there ๐ )
Methods
zero-p -> Boolean (none)โ returnstrueif the calling complex number instance is null.module -> Real (none)โ returns the module of the calling complex number instance.square-module -> Real (none)โ returns the square root of the of the calling complex number instance module. (double "the of" is in the source, we preserve it with love ๐ธ)get-real-part -> Real (none)โ returns the real part of the calling complex number instance. the grounded one. ๐ฑget-imaginary-part -> Real (none)โ returns the imaginary part of the calling complex number instance. the dreamer. ๐ฆ
๐ Character
The Character reserved object is literally the blueprint for a Unicode character type, and she ate. You can build one from a literal quoted notation, from a string, or from the U+ hexadecimal notation. The character class is designed to handle the full range of the Unicode character space by using an internal 32 bit quad representation with 31 bit valid. And bestie, the Character class also conforms with the ISO 10646 character representation. No cap. ๐
Predicate
character-p
Inheritance
Literal
Constructors
Character (none)โ creates a character object whose default value is the null character. Baby's first char, she's empty but full of potential ๐Character (String)โ creates a character object from the string object argument.Character (Integer)โ creates a character object from the integer object argument.Character (Character)โ creates a character object from the character object argument. Copy-paste but make it iconic โจ
Operators
== -> Boolean (Character)โ returnstrueif the calling object is equal to the character argument.!= -> Boolean (Character)โ returnstrueif the calling object is not equal to the character argument.< -> Boolean (Character)โ returnstrueif the calling character is less than the character object.<= -> Boolean (Character)โ returnstrueif the calling character is less equal than the character object.> -> Boolean (Character)โ returnstrueif the calling character is greater than the character object.>= -> Boolean (Character)โ returnstrueif the calling character is greater equal than the character object.++ -> Character (Character)โ increments the calling character by the next one in lexicographic order. She's moving up in the world ๐-- -> Character (Character)โ decrements the calling character by the previous one in lexicographic order. We love a lil step back ๐ฆ+= -> Character (Integer)โ adds the integer argument to the calling character.-= -> Character (Integer)โ subtracts the integer argument to the calling character.
Methods
letter-p -> Boolean (none)โ returnstrueif the character is a letter character,falseotherwise.digit-p -> Boolean (none)โ returnstrueif the character is a digit character,falseotherwise.alpha-p -> Boolean (none)โ returnstrueif the character is an alphanumeric character,falseotherwise.blank-p -> Boolean (none)โ returnstrueif the character is a blank or tab character,falseotherwise.eol-p -> Boolean (none)โ returnstrueif the character is an end-of-line character,falseotherwise.eos-p -> Boolean (none)โ returnstrueif the character is an end-of-stream character,falseotherwise.nil-p -> Boolean (none)โ returnstrueif the character is the nil character,falseotherwise.to-integer -> Integer (none)โ returns an integer representation of the characters.
๐ง Byte
The Byte reserved object implements the behavior of an 8 bit character type. You can construct a byte from an integer or from another byte. The Byte class is similar to the Character class but she's not a literal object, because she does not have a literal representation. Most of the time, a byte object is created by another object โ like a stream, when using the read method, for example. She's the supporting character who's actually carrying the whole plot ๐ซถ
Predicate
byte-p
Inheritance
Serial
Constructors
Byte (none)โ creates a byte object whose default value is the null byte.Byte (Integer)โ creates a byte object from the integer object argument. The integer value must be in the range of0x00to0xFF. Stay in your lane bestie, that's the whole lane ๐ญByte (Byte)โ creates a byte object from the byte object argument.
Operators
== -> Boolean (Byte)โ returnstrueif the calling object is equal to the byte argument.!= -> Boolean (Byte)โ returnstrueif the calling object is not equal to the byte argument.< -> Boolean (Byte)โ returnstrueif the calling byte is less than the byte object.<= -> Boolean (Byte)โ returnstrueif the calling byte is less equal than the byte object.> -> Boolean (Byte)โ returnstrueif the calling byte is greater than the byte object.>= -> Boolean (Byte)โ returnstrueif the calling byte is greater equal than the byte object.++ -> Byte (Byte)โ increments the calling byte by one. One singular step, periodt ๐-- -> Byte (Byte)โ decrements the calling byte by one.+= -> Byte (Integer)โ adds the integer argument to the calling byte.-= -> Byte (Integer)โ subtracts the integer argument to the calling byte.
Methods
eos-p -> Boolean (none)โ returnstrueif the character is an end-of-stream character,falseotherwise.nil-p -> Boolean (none)โ returnstrueif the byte is the nil byte,falseotherwise.to-integer -> Integer (none)โ returns an integer representation of the byte.to-char -> Character (none)โ returns a character representing the byte. Glow up transformation arc โจ
๐ String
The String reserved object implements the behavior of an internal character array. The double quote notation is the literal notation for a string. A string can also be constructed from the standard objects. Strings can be compared, transformed, or extracted with the help of the methods listed below. Internally, the string is represented as an array of Unicode characters. She's giving main character energy, fr fr ๐
Predicate
string-p
Inheritance
Literal
Constructors
String (none)โ creates a string object whose default value is the null string.String (Literal)โ creates a string object from the literal object argument.
Operators
== -> Boolean (String)โ returnstrueif the calling object is equal to the string argument.!= -> Boolean (String)โ returnstrueif the calling object is not equal to the string argument.< -> Boolean (String)โ returnstrueif the calling string is less than the string argument.<= -> Boolean (String)โ returnstrueif the calling string is less equal than the string argument.> -> Boolean (String)โ returnstrueif the calling string is greater than the string argument.>= -> Boolean (String)โ returnstrueif the calling string is greater equal than the string argument.+ -> String (String)โ returns the sum of the calling string with an string object. Friendship bracelets but for text ๐+= -> String (String)โ adds and assigns the calling string with the string argument.
Methods
length -> Integer (none)โ returns the length of the string. How many chars, bestie, let's count ๐first -> Character (none)โ returns the first character in the string.last -> Character (none)โ returns the last character in the string. Save the best for last, obviously ๐ฆstrip-left -> String (none|String)โ 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)โ 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)โ 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)โ splits 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. Break it down now โ๏ธextract -> Vector (Character)โ 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)โ converts all string characters to upper case and returns a new string. SHE'S LOUD NOW ๐ฃto-lower -> String (none)โ converts all string characters to lower case and returns a new string. now she's whispering ๐get -> Character (Integer)โ returns the string character at the position given by the argument. If the index is invalid, an exception is raised. Not me ignoring the bounds check... don't do that ๐sub-left -> String (Integer)โ 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)โ 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)โ okay so this one gives you a string that's been filled on the left with the character argument. The second argument is the length you want the result to be. If the calling string is already too long, the string is returned. No extra padding, no drama. ๐fill-right -> String (Character Integer)โ same energy but it fills on the right with the character argument. Second arg is the desired length of the resulting string. If the calling string is too long, the string is returned. Slay. โจsubstr -> String (Integer Integer)โ 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. So like, know your bounds bestie. ๐ญstrcic -> Boolean (String)โ compares the calling string with the argument string in a case insensitive way. That's it, that's the vibe. ๐ซถ
๐ Regex ๐
The Regex object is a special object which is automatically instantiated by the interpreter when using the delimiter character [ and ]. The regex syntax involves the use of standard characters, meta characters and control characters. Additionally, a string can be used to specify a series of characters. In its first form, the [ and ] characters are used as syntax delimiters. The lexical analyzer automatically recognizes this token as a regex and builds the equivalent Regex object. The second form is the explicit construction of the Regex object. Note also that the [ and ] characters are also used as regex block delimiters. Any character, except the one used as operators, can be used in a regex. The $ character is used as a meta-character -- or control character -- to represent a particular set of characters. For example, [hello world] is a regex which matches only the "hello world" string. The [$d+] regex matches one or more digits. The following control characters are builtin in the regex engine.
$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
The uppercase version is the complement of the corresponding lowercase character set. A character which follows a $ character and that is not a meta character is treated as a normal character. For example $[ is the [ character. A quoted string can be used to define character matching which could otherwise be interpreted as control characters or operator. A quoted string also interprets standard escaped sequences but not meta characters.
$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
A character set is defined with the < and > characters. Any enclosed character defines a character set. Note that meta characters are also interpreted inside a character set. For example, <$d+-> represents any digit or a plus or minus. If the first character is the ^ character in the character set, the character set is complemented with regards to its definition. The following unary operators can be used with single character, control characters and sub-expressions.
*โ match 0 or more times+โ match 1 or more times?โ match 0 or 1 time|โ alternation
Alternation is an operator which works with a secondary expression. Care should be taken when writing the right sub-expression. For example the following regex [$d|hello] is equivalent to [[$d|h]ello]. In other words, the minimal first sub-expression is used when compiling the regex. iykyk ๐
Predicate
regex-p
Inheritance
Literal
Constructors
Regex (none)โ creates a regex object whose default value is the null regex.Regex (String)โ creates a regex object with the string object argument. The string argument is the regex specification.
Operators
== -> Boolean (String)โ returns true if the argument is matched by the regex.!= -> Boolean (String)โ returns true if the argument is not matched by the regex.< -> Boolean (String)โ returns true if the argument is partially matched by the regex.
Methods
length -> Integer (none)โ returns the length of the group vector when a regex match has been successful.get -> String (Integer)โ returns by index the group sub-string when a regex match has been successful.match -> String (String)โ returns the first matching string of the argument string.replace -> String (String String)โ 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 is provided. The iterable-p predicate returns true if the container is an iterable object. The 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 moves the iterator to its next position. The prev method moves the iterator -- if possible -- to its previous position. The get-object method returns the object at the current iterator position. got it? good. ๐
๐งฉ Cons ๐งฉ
A Cons instance or simply a cons cell is a simple element used to build linked list. The cons cell holds an object and a pointer to the next cons cell. The cons cell object is called car and the next cons cell is called the cdr. Historically, car means Current Address Register and cdr means Current Data Register. This notation is still present here for the sake of tradition. the more you know โจ
Predicate
cons-p
Inheritance
SerialIterableCollectable
Constructors
Cons (none)โ creates a default cons cell with the car and cdr set tonil.Cons (Objects...)โ creates 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 cells together.
Methods
get-car -> Object (none)โ returns the car of the calling cons cell.get-cdr -> Cons (none)โ returns the cdr of the calling cons cell.get-cadr -> Object (none)โ returns the car of the cdr of the calling cons cell ornilif the cdr isnil.get-caddr -> Object (none)โ returns the car of the cdr of the cdr of the calling cons cell ornilif the cdr isnil.get-cadddr -> Object (none)โ returns the car of the cdr of the cdr of the cdr of the calling cons cell ornilif the cdr isnil.length -> Integer (none)โ returns the length of the cons cell. The minimum length returned is always1.nil-p -> Boolean (none)โ returns true if the car of the calling cons cell isnil, false otherwise.block-p -> Boolean (none)โ returns true if the cons cell is of type block, false otherwise.set-car -> Object (Object)โ sets the car of the calling cons cell. The object argument is returned by the method.set-cdr -> Cons (Cons)โ sets the cdr of the calling cons cell. The cons cell argument is returned by the method.add -> Object (Object)โ 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)โ returns the car of the cons cell chain at a certain position specified by the integer index argument.
๐ข Enum ๐ข
The Enum builtin object is an enumeration object. The enumeration is constructed with the reserved keyword enum and a list of literals or by string name with a constructor.
Predicate
enum-p
Inheritance
Object
Constructors
Enum (none)โ creates an empty enumeration.Enum (String...)โ creates an enumeration from a list of string arguments.
Methods
reset -> none (none)โ resets the enumeration and makes it empty.length -> Integer (none)โ returns the number of items in the enumeration.exists-p -> Boolean (String)โ 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)โ adds a new item to the enumeration by name. This method returnsnil.get -> String (Integer)โ returns an item string representation by index. The integer argument is the item index.
๐ List ๐
The List builtin object provides the facility of a double-link list. The List object is another example of iterable object. The List object provides support for forward and backward iteration. main character energy fr ๐
Predicate
list-p
Inheritance
Iterable
๐ ๏ธ Constructors ๐ ๏ธ
โจ Methods โจ
length -> Integer (none)โ hands you the length of the list bestie ๐ minimum length is0, aka the empty-list era.iterator -> Iterator (none)โ gives you a forward and backward iterator for this list, so you can vibe in either direction ๐ฆadd -> Object (Object)โ appends an object at the end of the list, and yep, it returns that same object argument back to you.insert -> Object (Object)โ inserts an object at the beginning of the list, and it also returns the object argument. main character energy, always first ๐get -> Object (Integer)โ returns the object sitting at a certain position, and that position is specified by the integer index argument.
๐ธ Strvec ๐ธ
The Strvec builtin object is giving index array of strings, and honestly it ate. It's a serializable object that stores strings, and you can add strings with an optional preference for a unique string value. Basically it's the general purpose Vector class's cousin, but string-coded ๐
Predicate
strvec-p
Inheritance
Serial
Constructors
Strvec (none)โ creates an empty string vector. blank slate, fresh start โจStrvec (Integer|Boolean)โ creates a string vector with a predefined size or with auniqflag. First form: the preferred vector size is given as the argument. Second form: the string unicity flag is given as the argument.Strvec (Integer Boolean)โ creates a string vector with a predefined size and auniqflag. First argument = the preferred vector size. Second argument = the string unicity flag.
Methods
reset -> none (none)โ resets the string vector. Once it's done, the string vector is empty, periodt.length -> Integer (none)โ returns the length of the string vector. Minimum length is0for an empty vector.min-length -> Integer (none)โ returns the minimum string length in the string vector.max-length -> Integer (none)โ returns the maximum string length in the string vector.empty-p -> Boolean (none)โ returnstrueif the vector is empty. vibe check: empty? ๐active-p -> Boolean (none)โ returnstrueif the vector is not empty. It's literally the negation ofempty-p, no cap.get -> String (Integer)โ returns the string in the vector at a certain position, specified by the integer index argument.set -> none (Integer String)โ sets a vector position with a string. First argument = the vector index. Second argument = the string to set.first -> String (none)โ returns the first string in the vector ๐ฅlast -> String (none)โ returns the last string in the vector.pop -> Object (none)โ removes the first element in the string vector and returns it.pop-last -> String (none)โ removes the last element in the string vector and returns it.find -> Integer (String)โ tries to find a string in the vector. Found it? you get the vector index. Didn't? you get the-1value ๐lookup -> Integer (String)โ also tries to find a string in the vector. Found it? vector index. Didn't? an exception is raised. she's dramatic like that ๐ญadd -> none (String)โ adds an object at the end of the vector. If theuniqflag is active, the string argument is not added if it already exists.exists-p -> Boolean (String)โ returnstrueif the string argument exists in the vector.remove -> none (Integer|String)โ removes a string from the vector by index or by value. First form: the vector index is used as the place to remove. Second form: the string argument is used as a key for removal. Heads up bestie, this method repacks the vector once the string has been removed.set-unique -> none (Boolean)โ sets the string vector unique flag. When the unique flag is set, there is only no string duplicate in the vector. ๐get-unique -> Booleanโ returns the string vector unique flag value.concat -> String (none | Character)โ concatenates the string vector elements with a character separator. First form, with a separator character: the resulting string is the concatenation of the string vector elements. Second form: the resulting string is the concatenation of the vector elements with a character separator. If the character separator isnilthen no separator is placed. ๐ง
๐ Vector ๐
The Vector builtin object gives you an index array of objects. It's another example of an iterable object, and it provides support for forward and backward iteration. iconic behavior honestly ๐ฅ
Predicate
vector-p
Inheritance
SerialIterableCollectable
Constructors
Vector (none)โ creates an empty vector.Vector (Object...)โ creates a vector from a list of object arguments.
Methods
reset -> none (none)โ resets the vector. When it's complete, the vector is empty.length -> Integer (none)โ returns the length of the vector. Minimum length is0for an empty vector.empty-p -> Boolean (none)โ returnstrueif the vector is empty.get -> Object (Integer)โ returns the object in the vector at a certain position, specified by the integer index argument.set -> Object (Integer Object)โ sets a vector position with an object. First argument = the vector index. Second argument = the object to set. And yes, the method returns the object to set ๐ซถfirst -> Object (none)โ returns the first element in the vector.last -> Object (none)โ returns the last element in the vector.pop -> Object (none)โ removes the first element in the vector and returns it.pop-last -> Object (none)โ removes the last element in the vector and returns it.find -> Integer (Object)โ tries to find an object in the vector. If the object is found, the vector index is returned as anIntegerobject; elsenilpis returned. ๐add -> Object (Object|Integer Object)โ appends an object at the end of the vector, or at a certain index. First form: the object argument is added at the end of the vector. Second form: the object argument is inserted in the vector at the specified index. Either way, the object argument is returned by this method.exists-p -> Boolean (Object)โ returnstrueif the object argument exists in the vector. Super useful to make sure only one occurrence of an object gets added to a vector ๐clean -> none (Integer)โ removes an object from the vector by index and repacks the vector.remove -> none (Object)โ removes an object from the vector and repacks the vector. If duplicates exist in the file, only one is removed.
๐ HashTable ๐
The HashTable builtin object is a container object that maps an object with a name. It's dynamic and gets resized automatically when needed โ she grows, she adapts, she slays โจ The lookup method throws an exception if the name isn't found. The get method returns nilp if the object isn't found. The table can be configured to operate in a case insensitive way, and if the case flag is changed, the table is automatically reset.
Predicate
hashtable-p
Inheritance
Object
Constructors
HashTable (none)โ creates an empty table.HashTable (Boolean)โ creates a table by case insensitive flag.HashTable (Integer)โ creates a table with a specific size.HashTable (Integer Boolean)โ creates a table by size and case insensitive flag.
Methods
reset -> none (none)โ resets the table so that it becomes empty.add -> none (String Object)โ adds a new object in the table by key. First argument = the key used to associate the object in the table. Second argument = the object to add.length -> Object (none)โ returns the number of objects in the table.empty-p -> Boolean (none)โ returnstrueif the table is empty.set-case-flag -> none (Boolean)โ sets the case insensitive flag. And listen, the table is automatically reset when this method is called ๐get-case-flag -> Boolean (none)โ returns the case insensitive flag.get -> Object (String)โ returns the object associated with a key. If the key isn't found,nilis returned.lookup -> Object (String)โ returns the object associated with a key. If the key isn't found, an exception is raised ๐ญget-key -> String (Integer)โ 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)โ bestie, this one returns the object thatโs linked to a table entry by index. If the index is out of range, an exception gets raised, no cap. ๐
๐ Set ๐
The Set builtin object is giving โuniform set of objectsโ energy. Itโs another example of an iterable object, bestie. And it provides support for forward and backward iteration. Main character behavior. โจ
Predicate
set-pโ the vibe check.
Inheritance
SerialIterableโ it inherits from this.
Constructors
Set (none)โ creates an empty set. Literally nothing in it. Empty. Like my wallet. ๐ญSet (Object...)โ creates a set from a list of object arguments. Slay.
Methods
reset -> none (none)โ resets the set. When the method is complete, the set is empty. Periodt.length -> Integer (none)โ returns the number of elements in the set. The minimum length is0for an empty set.add -> Object (Object)โ 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)โ returns object by index.empty-p -> Boolean (Object)โ theempty-ppredicate returns true if the set is empty.exists-p -> Boolean (Object)โ theexistspredicate returns true if the object argument exists in the set.merge -> none (Set)โ merges the set argument into the calling set. If an element already exists in the set, it is not added.remix -> none (Integer)โ mixes the set by randomly swapping all the elements. This method is useful when the set has been filled with a certain order but the access must be done randomly.remove -> Boolean (Object)โ 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)โ returns a subset whose 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.iterator -> Iterator (none)โ returns an iterator for this set. The iterator supports forward and backward iteration.
๐ Queue ๐
The Queue builtin object is a container used to push and pop objects. The queue works like a fifo, with the notable exception that it is blocking in push and pop. So itโs giving โwait for itโ energy. โณ
Predicate
queue-pโ the vibe check.
Inheritance
Objectโ it inherits from this.
Constructors
Queue (none)โ creates an empty queue.Queue (size)โ creates a queue by size.
Methods
push -> none (Object)โ pushes an object in the queue. Thepushmethod will block if the queue is full.pop -> Object (none)โ dequeues an object in the order it was pushed. Thepopmethod will block if the queue is empty.length -> Object (none)โ returns the number of queued objects.empty-p -> Boolean (none)โ returns true if the queue is empty.reset -> none (none)โ resets the queue.
๐ Heap ๐
The Heap builtin object is an object based heap class that organizes objects with respect to a key. The heap is organized as a binary tree whose root element is either the object with the highest or the lowest key. A flag controls whether the heap is operating in ascending or descending mode. By default, the heap operates in ascending mode, which means that the root node is the lowest one. The heap is self-resizable. The object insertion is also controlled by a minimum and maximum key. If the key is below the minimum key or above the maximum key, the object is not inserted. So picky. ๐
Predicate
heap-pโ the vibe check.
Inheritance
Objectโ it inherits from this.
Constructors
Heap (none)โ creates an empty heap. By default the heap operates in ascending mode.Heap (Integer)โ creates a heap with a specific size. By default the heap operates in ascending mode.Heap (Boolean)โ creates 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)โ creates 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)โ 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)โ pops the first available in the heap. If the heap is empty, an exception is raised.length -> Object (none)โ returns the number of objects in the heap.empty-p -> Boolean (none)โ returns true if the heap is empty.reset -> none (none)โ resets the heap so that it becomes empty.get-key -> Integer (Integer)โ 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)โ 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)โ 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)โ themin-key-ppredicate returns true if a minimum key has been set. Theget-min-keymethod can be used to retrieve the minimum key value.max-key-p -> Boolean (none)โ themax-key-ppredicate returns true if a maximum key has been set. Theget-max-keymethod can be used to retrieve the maximum key value.reset-min-key -> none (none)โ resets the minimum key flag and value.reset-max-key -> none (none)โ resets the maximum key flag and value.set-min-key -> none (Integer)โ sets the minimum key value.get-min-key -> Integer (none)โ returns the minimum key value.set-max-key -> none (Integer)โ sets the maximum key value.get-max-key -> Integer (none)โ returns the maximum key value.resize -> none (none)โ resizes the heap with a new size. If the size is lower than the number of elements, the procedure does nothing.
๐ง Bitset ๐ง
The Bitset builtin object is a container for multi bit storage. The size of the bitset is determined at construction. With the use of an index, a particular bit can be set, cleared and tested. So bit manipulation, bestie. ๐
Predicate
bitset-pโ the vibe check.
Inheritance
Objectโ it inherits from this.
Constructors
Bitset (none)โ creates an empty bitset.Bitset (Integer)โ creates a bitset whose size is given by the integer argument.Bitset (String)โ creates a bitset by parsing the string argument. The string can be either in the normal binary form with or without the0bprefix or in hexadecimal form with the0xprefix.Bitset (Buffer Boolean)โ creates 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 first 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)โ resets the bitset and forces the initial size to0.marked-p -> Boolean (Integer)โ themarked-ppredicate returns true if the bit is set at the index argument.clear -> none (Integer)โ clears a bit by the index argument.mark -> none (Integer)โ marks a bit by the index argument.mark -> none (Integer Boolean)โ sets the bit value by the index argument with the boolean second argument.add -> none (Integer Boolean)โ adds a bit in the bitset at the given position. The first argument is the bit position and the second argument is the bit value. Theaddmethod is the only method that resizes a bitset.set -> none (Integer|String)โ sets a bitset with an integer value. In the first form with an integer argument, the bitset is completely reset to a64bits 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)โ clamps a bitset by boolean value. The bitset size is determined by finding the upper bit index that matches the boolean argument.length -> Integer (none)โ hands you the length of the bitset... in bits, bestie, not bytes, don't get it twisted. ๐to-byte -> Integer (Byte)โ maps a lil' chunk of the bitset onto a byte at one specific position. The integer arg is the bit position that gets mapped to the byte lsb. precise queen behavior. โจsubset -> Integer (Bitset)โ gives you a sub bitset, sized by you.subset -> Integer Integer (Bitset)โ gives you a sub bitset by size and position. First integer arg = how big the sub bitset is. Second arg = where in the bitset you're extracting it from. two args, zero confusion. ๐
๐ซง BUFFER ๐ซง
The Buffer builtin object is a byte buffer and it is everywhere when you're doing i/o, no cap. You can construct it with or without literal arguments. The standard methods to add or push-back bytes or characters? All present, all accounted for. One method that is genuinely iconic is write, which can write a complete buffer to an output stream you pass in as an argument. By default, the buffer operates in resize mode. But heads up โ if you configure the buffer to run in non-resize mode, an exception gets raised the moment you try to add a character while the buffer is full. ๐ญ rude but that's the rules.
Predicate
buffer-p
Inheritance
Object
Constructors
Buffer (none)โ creates an empty buffer, and it's set up to operate in resize mode. fresh start energy. ๐ธBuffer (Literal...)โ creates a buffer from a list of literal object arguments. Each literal argument gets turned into a byte representation which is then added into the buffer.
Methods
add -> Integer (Byte|Literal|Buffer)โ adds a byte, a literal object or a buffer to the calling buffer. The object argument gets auto-converted into a sequence of bytes. If it's a buffer, the entire content is copied in. Returns the number of bytes added. ๐ซถget -> Byte (none)โ returns the next available byte in the buffer but does not remove it. look, don't touch. ๐read -> Byte (none)โ returns the next available character and removes it from the buffer. gone, taken, deleted. ๐reset -> none (none)โ resets the entire buffer and destroys its contents. everything must go. ๐ฅlength -> Integer (none)โ returns the length of the buffer.full-p -> Boolean (none)โ returnstrueif the buffer is full. If the buffer is re-sizeable, this method always returnsfalse. yes always, don't @ me.empty-p -> Boolean (none)โ returnstrueif the buffer is empty.resize-p -> Boolean (none)โ returnstrueif the buffer is re-sizeable.to-string -> String (none)โ returns a string representation of the buffer.format -> String (none)โ returns an octet string representation of the buffer.pushback -> Integer (Byte|Literal|Buffer)โ pushes back a byte, a literal object or a buffer in the calling buffer. The object argument gets auto-converted into a sequence of bytes. If it's a buffer, the entire content is copied in. Returns the number of byte pushbacked. ๐get-host-word -> Integer (none)โ reads a word from the buffer and converts it to an integer. The word is assumed to be in network byte order and gets converted into host byte order before becoming an integer.get-host-quad -> Integer (none)โ reads a quad from the buffer and converts it to an integer. The quad is assumed to be in network byte order and gets converted into host byte order before becoming an integer.get-host-octa -> Integer (none)โ reads an octa from the buffer and converts it to an integer. The octa is assumed to be in network byte order and gets converted into host byte order before becoming an integer.set-resize -> none (Boolean)โ sets the resize flag for a particular buffer. You can use this method at any time. anytime bestie, no appointment needed. ๐shl -> none (Integer)โ shifts the buffer left by a certain number of characters. The integer argument is the number of characters to shift. โญ
๐ BLOCKBUFFER ๐
The BlockBuffer builtin object is a special buffer class designed to hold bytes in a bound or unbound way. In bound mode, the buffer size is known and the buffer cannot be resized. In unbound mode, the buffer size is unknown and the buffer can be resized as needed. This block buffer is built to be loaded by various means, including data, buffer or stream. And on top of that, the block buffer can be used to write into another buffer or a stream, block by block. By default the read and write block size is the system block size, and the default mode is the bound mode โ which you can change by setting the buffer resize flag. ๐
Predicate
block-buffer-p
Inheritance
Buffer
Constructors
BlockBuffer (none)โ creates a non-resizable empty block buffer.BlockBuffer (Integer)โ creates a non-resizable block buffer. The integer argument is the block buffer size.
Methods
read-count -> Integer (none)โ returns the number of characters read by the buffer. The read counter gets increased during any read operation that might decrease the buffer length. counting every crumb. ๐write-count -> Byte (none)โ returns the number of characters writen into the buffer.copy -> Integer (String|Buffer|InputStream|OutputStream)โ copies an object into or from the block buffer. In the first form, a string, a buffer or an input stream is issued 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 being written to the output stream. The total number of characters copied is returned by this method. When you use a multiple types object that implements both the input and output stream model, the priority is given to the input stream type. iykyk. โจcopy-input-stream -> Integer (InputStream)โ copies an input stream into the block buffer. Basically thecopymethod but it only operates with an input stream. Super useful when you're working with an object that implements multiple stream types. ๐ฆcopy-output-stream -> Integer (OutputStream)โ copies an output stream into the block buffer. Same vibe ascopybut it only operates with an output stream. Also the move when your object implements multiple stream types. ๐
๐ PROPERTY ๐
The Property builtin object is a container for a name/value pair. Generally, the property object gets used inside a property list. And plot twist โ an optional information field can be inserted into the property too. extra info, no extra charge. ๐
Predicate
property-p
Inheritance
Serial
Constructors
Property (none)โ creates an empty property.Property (String)โ creates a property by name. The first argument is the property name.Property (String Literal)โ creates a property by name and value. The first argument is the property name. The second argument is the property value.Property (String String Literal)โ creates 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. three-for-one deal, obsessed. ๐ธ
Methods
set -> none (String Literal)โ 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)โ sets the property name.get-name -> String (none)โ returns the property name.set-info -> none (String)โ sets the property information.get-info -> String (none)โ returns the property information.set-value -> none (Literal)โ sets the property value. The literal argument gets converted to its string representation.get-value -> String (none)โ returns the property string value.get-boolean-value -> Boolean (none)โ returns the property boolean value.get-integer-value -> Integer (none)โ returns the property integer value.get-real-value -> Real (none)โ returns the property real value.
โจ PLIST โจ
The Plist builtin object is a base container class used to manage property objects in an ordered way. The property list operates by maintaining a vector of property objects alongside a hash table that lets it find the object quickly. organized and fast, that's the whole flex. ๐
Predicate
plist-p
Inheritance
SerialIterableNameable
Constructors
Plist (none)โ creates an empty property list.Plist (Boolean)โ creates a property list with a case flag.Plist (String)โ creates a property list by name.Plist (String String)โ creates a property list by name and info.
Methods
set-name -> none (String)โ sets the property list name.set-info -> none (String)โ sets the property list info.get-info -> String (none)โ gives you back the property list's info, as aString. That's it, that's the whole vibe.add -> none (Property | String Literal | String String Literal)โ adds a property to the list, and it comes in three flavors. Form one: the argument is a property object, periodt. Form two: first argument is the property name, second is the property value. Form three: first argument is the property name, second is the property info, third is the property value. ๐ซถ
bestie listen โ if that property already exists, an exception gets raised. No overwriting, no sneaky business. ๐ญ
set -> none (Property | String Literal | String String Literal)โ same three shapes asadd, but this one is the chill one: it adds or sets the property. Form one: the argument is the property itself. Form two: name then value. Form three: name, info, then value. And if the property already exists? The value just gets changed. slay. โจget -> Property (Integer)โ hands you a property back by its index. Number goes in, property comes out.reset -> none (none)โ wipes the property list clean. fresh start energy ๐งempty-p -> Boolean (none)โ theempty-ppredicate. Returnstrueif the property list is empty, and you already know what it returns otherwise.length -> Integer (none)โ how many properties are living in the list. A count. A census. ๐exists-p -> Boolean (String)โ returnstrueif a property exists. The string argument is the property name, iykyk.find -> Property (String)โ finds a property by name; the string argument is that name. But if the property doesn't exist? You getnil. No drama, no exception, justnil. ๐lookup -> Property (String)โ same hunt, different temperament: finds a property by name (string argument = the name), except if it doesn't exist, an exception gets raised.findis the chill sibling,lookupis the one who yells. ๐get-value -> String (String)โ returns the property value. String argument is the property name. And yeah, if that property doesn't exist, exception, same aslookup.to-print-table -> PrintTable (none | Boolean | Boolean Boolean)โ converts the property list into a print table, and it can be formatted using the property info and value. Three forms, bestie:- Form one: the print table is formatted without the info field, in normal value.
- Form two: the boolean flag controls whether or not the info field is added into the table.
- Form three: the second boolean controls whether or not the real property values get converted into scientific notation.
โจ SPECIAL OBJECTS โจ
This chapter is the reference for the reserved special objects and their built-in methods. Special objects are the ones that interact with the interpreter itself. Main character objects only, no cap. ๐
Object
The base object Object brings several methods that are common to all objects. Everything inherits from here, so this is basically the group chat everyone's in.
Methods
repr -> String (none)โ returns the object name as a string. That resulting string is called the representation string. iconic behavior.rdlock -> none (none)โ tries to acquire the object in read-lock mode. If the object is currently locked in write mode by another thread, the calling thread gets suspended until the lock is released. It just sits there and waits, patiently, like a bestie outside the fitting room. ๐wrlock -> none (none)โ tries 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)โ tries to unlock an object. And here's the rule: an object gets unlocked if and only if the calling thread is the one who acquired the lock. Don't touch other people's locks, that's not your business. ๐clone -> Object (none)โ returns a clone of the calling object. And if the object can't be cloned, an exception is raised. Not everything can be duplicated, bestie, and that's valid.
Interp
Interp is the interpreter object, and it's automatically bound for each executable program. There is no constructor for this object โ you don't make one, it just exists. The current interpreter is bound to the interp reserved symbol. it's giving destined-for-greatness ๐
Predicate
interp-p
Inheritance
Runnable
Constants
argvโ the interpreter argument vector. It's initialized when the interpreter is created, and each argument is stored as a string object. ๐os-nameโ the operating system name. Evaluates as a string.os-typeโ the operating system type. Evaluates as a string.versionโ the full engine version. Evaluates as a string.program-nameโ the interpreter program name. Evaluates as a string.major-versionโ the interpreter major revision number. Evaluates as an integer.minor-versionโ the interpreter minor revision number. Evaluates as an integer.patch-versionโ the interpreter patch revision number. Evaluates as an integer.afnix-uriโ the official uri. Evaluates as a string.machine-sizeโ the interpreter machine size, expressed in bits. Most of the time it's either32or64bits, but if you get something else back, it certainly reflects an exotic platform. mystery machine energy ๐ฆloaderโ the interpreter library loader. Under normal circumstances, the library loader should not be used โ the standardinterp:libraryform is the move instead.resolverโ the interpreter resolver. It can be used to dynamically add a librarian or a directory to the interpreter module resolver.
Methods
load -> Boolean (String|String Boolean|String String Boolean)โ opens a module whose name is the argument and executes each form in it via a read-eval loop. When all the forms have been executed, the module gets closed and the method returnstrue. In case of exception, the module is closed and the method returnsfalse. Three forms:- Form one: the module is loaded by name only once.
- Form two: the module is loaded with a force flag set to
true. - Form three: the module is given a tag, which is used to detect whether or not the module has been loaded. And if no tag is given, the module name is used instead.
library -> Library (String)โ opens a shared library and returns a shared library object. ๐launch -> Thread (form|thread form)โ executes the form argument in a normal thread. The normal thread is created by cloning the current interpreter.- Form one: a thread object is created by the method and returned once the thread has been launched.
- Form two: a thread is started by binding a form to the thread object.
daemon -> Boolean (none)โ puts the running interpreter into daemon mode. A new detached process is spawned with the interpreter attached to it. The boolean result tells you whether or not the operation was successful. โจset-epsilon -> none (Real)โ sets the interpreter epsilon, which corresponds to the real precision. That real precision is what the?=operator uses to compare real values. tiny numbers, big responsibilities ๐ฌget-epsilon -> Real (none)โ returns the interpreter epsilon, which corresponds to the real precision. Again, the real precision is what the?=operator uses to compare real values.dup -> Interp (none|Terminal)โ returns a clone of the current interpreter, binding the terminal stream argument. With no argument, a new terminal object is automatically created and bound to the newly created interpreter. ๐loop -> Boolean (none)โ executes the interpreter main loop by reading the interpreter input stream. The loop finishes when the end-of-stream is reached with the input stream. Returns a boolean flag telling you whether or not the loop was successful.set-primary-prompt -> none (String)โ sets the interpreter terminal primary prompt, the one used during the interpreter main loop.set-secondary-prompt -> none (String)โ sets the interpreter terminal secondary prompt, also used during the interpreter main loop.get-primary-prompt -> String (none)โ returns the interpreter terminal primary prompt.get-secondary-prompt -> String (none)โ returns the interpreter terminal secondary prompt.read-line -> String (none|Boolean)โ reads a line from the interpreter terminal. If no terminal is bound to the interpreter, the empty string is returned.- Form one: a line is read after printing the primary prompt.
- Form two: a boolean flag controls the prompt display, which can be primary or secondary.
read-passphrase -> String (none|String)โ reads a pass-phrase from the interpreter terminal. If no terminal is bound to the interpreter, the empty string is returned. With a string argument, that string is displayed as a prompt before reading the passphrase. ๐คซ
Thread
The Thread object is a special object that acts as a thread descriptor. Such an object is created with the launch reserved keyword.
Predicate
thread-p
Inheritance
Object
Constructors
Thread (none)โ okay so this constructor makes a default thread object with no form bound to it at all. You can use that object later with thelaunchcommand. ๐
Methods
end-p -> none (none)โ theend-ppredicate returnstrueif the thread argument has finished. This predicate is basically saying the thread result is a valid one. โจwait -> none (none)โ thewaitmethod suspends the calling thread until the thread argument is completed. This is the primary mechanism to detect a thread completion. no cap.result -> Object (none)โ theresultmethod returns the thread result. If the thread is not completed, thenilvalue is returned. BUT โ and this is important, bestie โ this method should not be used to check if a thread has completed. You must use thewaitmethod instead, because a thread result might benil. ๐ญ
Condvar
The condition variable Condvar object is a special object that provides a mean of synchronization between one and several threads. The condition is said to be false unless it has been marked. When a condition is marked, all threads waiting for that condition to become true are notified and one thread is activated with that condition. ๐ฆ
Predicate
condvar-p
Inheritance
Object
Constructors
Condvar (none)โ theCondvarconstructor creates a default condition variable. periodt.
Methods
lock -> none (none)โ thelockmethod 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)โ themarkmethod marks the condition variable and notify all pending threads of such change. Themarkmethod is the basic notification mechanism. ๐wait -> none (none)โ thewaitmethod 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)โ theresetmethod 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)โ theunlockmethod unlock the condition variable mutex. This method should be used after a call tolockorwait. ๐wait-unlock -> none (none)โ thewait-unlockmethod 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 towait. ๐
Lexical
The Lexical object is a special object built by the reader. A lexical name is also a literal object. Although the best way to create a lexical name is with a form, the lexical object can also be constructed with a string name. A lexical name can be mapped to a symbol by using the map method. ๐
Predicate
lexical-p
Inheritance
Literal
Constructors
Lexical (none)โ theLexicalconstructor create an empty lexical object which evaluates tonil. ๐ซงLexical (String)โ theLexicalconstructor create a lexical object using the string argument as the lexical name. โจ
Methods
map -> Object (none)โ themapmethod 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
The Qualified object is a special object built by the reader. A qualified object is similar to a lexical object. It is also a literal object. Like a lexical name, a qualified name can be created with a form or by direct construction with a name. Like a lexical name, the map method can be used to retrieve the symbol associated with that name. ๐ฆ
Predicate
qualified-p
Inheritance
Literal
Constructors
Qualified (none)โ theQualifiedconstructor create an empty qualified name object which evaluates tonil. ๐Qualified (String)โ theQualifiedconstructor 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)โ themapmethod 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
The Symbol object is a special object used by nameset to map a name with an object. Generally a symbol is obtained by mapping a lexical or qualified name. As an object, the symbol holds a name, an object and a constant flag. The symbol name cannot be changed since it might introduce inconsistencies in the containing nameset. On the other hand, the constant flag and the object can be changed. A symbol is a literal object. A symbol that is not bounded to a nameset can be constructed dynamically. Such symbol is said to be not interned. ๐
Predicate
symbol-p
Inheritance
Literal
Constructors
Symbol (String)โ theSymbolconstructor create a symbol by name. The associated object is marked asnil. ๐ท๏ธSymbol (String Object)โ theSymbolconstructor create a symbol by name and bind the object argument to the symbol. ๐
Methods
get-const -> Boolean (none)โ theget-constmethod returns the symbol const flag. If the flag istrue, the symbol object cannot be changed unless that flags is reset with theset-constmethod. ๐ฉset-const -> none (Boolean)โ theset-constmethod 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)โ theget-objectmethod returns the symbol object. ๐ฆset-object -> none (Object)โ theset-objectmethod set the symbol object. The object can be obtained by evaluating the symbol. ๐งฎ
Closure
The Closure object is a special object that represents a lambda or gamma expression. A closure is represented by a set of arguments, a set of closed variables and a form to execute. A boolean flag determines the type of closure. The closure predicate lambda-p returns true if the closure is a lambda expression. Closed variables can be defines and evaluated with the use of the qualified name mechanism. Closure mutation is achieved with the add-argument and set-form method. An empty closure can be defined at construction as well. ๐
Predicate
closure-p
Inheritance
Object
Constructors
Closure (none)โ theClosureconstructor 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 symbolselfis automatically bounded for this closure. ๐งฌClosure (Boolean)โ theClosureconstructor create a closure which acts as lambda expression if the boolean argument istrue. If the boolean argument isfalse, the closure will behave like a gamma expression. ๐
Methods
gamma-p -> Boolean (none)โ thegamma-ppredicate returnstrueif the closure is a gamma expression. The predicate returnstruefor a lambda expression. (Yes, bestie, that's literally what it says. ๐)lambda-p -> Boolean (none)โ thelambda-ppredicate returnstrueif the closure is a lambda expression. The predicate returnsfalsefor a gamma expression. ๐get-form -> Object (none)โ theget-formmethod returns the closure form object. ๐set-form -> none (Object)โ theset-formmethod sets the closure form object. โ๏ธadd-argument -> none (String|Lexical|form)โ theadd-argumentmethod 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
The Librarian object is a special object that read or write a librarian. Without argument, a librarian is created for writing purpose. With one file name argument, the librarian is created for reading. ๐
Predicate
librarian-p
Inheritance
Nameable
Constructors
Librarian (none)โ theLibrarianconstructor creates a librarian for writing. Initially, the librarian is empty and files must be added with theaddmethod. ๐Librarian (String)โ theLibrarianconstructor creates a librarian for reading using the name as the librarian file name. ๐
Methods
add -> none (String)โ theaddmethod adds a file into the librarian. The librarian must have been opened in write mode. ๐ฅwrite -> none (String)โ thewritemethod writes a librarian to a file those name is the argument. ๐คlength -> Integer (none)โ thelengthmethod returns the number of file in the librarian. This method work, no matter how the librarian has been opened. ๐ขexists-p -> Boolean (String)โ theexists-ppredicate returnstrueif the file argument exists in the librarian. โextract -> InputMapped (String)โ theextractmethod returns an input stream mapped to the file name argument. ๐
Resolver
The Resolver object is a special object that gives the ability to open a file based on a file path resolver. The resolver maintains a list of valid path and returns an input stream for a file on demand. ๐บ๏ธ
Predicate
resolver-pโ the vibe check ๐
Inheritance
Object
Constructors
Resolver(none) โ makes you a default resolver, fresh out the box. Once it exists, you hit it with theaddmethod to feed it paths.
Methods
add->none(String) โ drops a path into the resolver. That path can point at a directory or at a librarian. Both valid, bestie ๐ซถlookup->InputStream(String) โ takes the file name you hand it, resolves it, and hands you back an input stream for that file. โจto-string->String(String) โ resolves the file name argument and gives you a string representation of that file instead.valid-p->Boolean(String) โ the lil truth-teller ๐ returnstrueif the file name argument can actually be resolved. And if it can be resolved? You can go ahead and calllookupto grab an input stream. no cap.
๐ PrintTable ๐
The PrintTable class is a formatting class for tables. You build the table with a number of columns โ which defaults to 1 โ and eventually a number of rows. Once the table exists, elements get added with the add method, and any specific table element can be set with the set method. The class ships a format method whose default behavior is to print the table on the interpreter standard output. Give it an output stream argument or a buffer and the table gets formatted into those objects instead. โจ
The formatting includes an optional column width, a filling character, and a filling direction flag. By default, the column width is 0, which means the column width is computed as the maximum length of all the column elements. If you set the column width with the set-column-size method, the string element might get truncated to the left or to the right โ depending on the filling flag โ so it fits the column width. ๐ซฃ
Each table element can also be associated with a tag. The tag-p method tests for the presence of a tag, while set-tag and get-tag set or get the tag by row and column coordinates. iykyk ๐
Predicate
print-table-p
Inheritance
Object
Constructors
PrintTable(none) โ creates a default table with one column.PrintTable(Integer) โ creates a table with a pre-defined number of columns, specified in the constructor argument.PrintTable(Integer Integer) โ creates a table with a pre-defined number of columns and rows, specified in the constructor arguments.
Methods
head-p->Boolean(none) โ returnstrueif the table header is defined. ๐add-head->none([String+]) โ adds the string arguments to the table header. The number of arguments must equal the number of columns. fr fr, don't try to fudge it.get-head->String(Integer) โ returns a table header element by column index. The integer argument is the header row index.set-head->none(Integer String) โ sets a table header element by column index. First argument is the header column index, second is the header string value to set.add->Integer(none|[Literal...]) โ this one wears many hats ๐ Without arguments, a new row is added and the row index comes back to you. That row index can later be used with thesetmethod to set a particular table element. With one or several literal arguments โ whose length must match the number of columns โ a new row is created and those arguments get added to the table. The row number is returned too.get->String(Integer Integer) โ returns a particular table element by row and column. First argument is the table row index, second is the table column index.set->none(Integer Integer Literal) โ sets a particular table element by row and column. First argument is the table row index, second is the table column index. The last argument is a literal object that gets converted to a string prior to its insertion.tag-p->Boolean(Integer Integer) โ returnstrueif a tag is present at a particular table element. First argument is the table row index, second is the table column index.set-tag->none(Integer Integer String) โ sets a particular table tag by row and column. First argument is the table row index, second is the table column index. The last argument is the tag value.get-tag->String(Integer Integer) โ returns a particular table tag by row and column. First argument is the table row index, second is the table column index.dump->none|String(none|Integer|OutputStream|Buffer) โ dumps the table to an output stream or a buffer. No argument? The default interpreter output stream gets used. Integer argument? That specified row is used and a string comes back. Buffer or output stream? The whole table gets written and nothing is returned. ๐ฆmerge->none(PrintTable[Boolean Boolean]) โ merges a table into the calling one. In the first form, only the table content is merged. In the second form, the boolean arguments control whether the header and footer shall be merged as well.format->none|String(none|Integer|OutputStream|Buffer) โ writes the formatted table to an output stream or a buffer. No argument? Default interpreter output stream. Integer argument? That specified row is used and a string is returned. Buffer or output stream? The whole table is written and nothing is returned. โจget-rows->Integer(none) โ returns the number of rows in the table.add-columns->Integer(none) โ adds 1 or more columns at the end of the table.get-columns->Integer(none) โ returns the number of columns in the table.set-column-size->none(Integer Integer) โ sets the desired width for a particular column. First argument is the column index, second argument is the column width. If0is given, the column width is computed as the maximum of the column elements.get-column-size->Integer(Integer) โ returns the desired width for a particular column.set-column-fill->none(Integer Character) โ sets the filling character for a particular column. First argument is the column index, 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) โ returns the filling character for a particular column.set-column-direction->none(Integer Boolean) โ sets the direction flag for a particular column. First argument is the column index, second argument is a boolean. Afalsevalue means filling by the left, atruevalue means filling by the right. The column filling character is used for this operation. ๐get-column-direction->Boolean(Integer) โ returns the direction flag for a particular column.
๐ Logger ๐
The Logger class is a message logger that stores messages in a buffer, with a level. The default level is level 0. A negative level generally indicates a warning or an error message โ but bestie, that's just a convention, the class does not enforce it. A high level generally indicates a less important message.
The messages are stored in a circular buffer. When the logger is full, a new message replaces the oldest one. ๐ By default, the logger is initialized with a 256 messages capacity, and that can be resized.
Predicate
logger-p
Inheritance
Object
Constructors
Logger(none) โ creates a default logger.Logger(Integer) โ creates a logger with a specific size, specified as the constructor argument.Logger(String) โ creates a logger with an information argument. That information string is later used to format the logged messages.Logger(Integer String) โ creates a logger with a specific size and an information argument. First argument is the logger size, second argument is the information string. The information string is later used to format the logged messages. โจ
Methods
add->none(String|String Integer) โ adds a message into the logger. With one argument, the method takes a single string message. With two arguments, the first argument is the message and the second argument is the message level.reset->none(none) โ resets the logger class by removing all messages. ๐งนlength->Integer(none) โ returns the number of messages stored in the logger object.resize->none(Integer) โ resizes the logger class by increasing the size of the message buffer. The old messages are kept during the resizing operation. ๐ซถset-info->none(String) โ sets the logger information string. The information string is used by the derived classes when a message is printed.get-info->String(none) โ returns the logger information string. The information string is used by the derived classes when a message is printed.set-default-level -> none (Integer)โ okay so this method sets the default level used for storing messages. This parameter is used with theaddmethod in conjunction with themessageargument. When the message level is specified, the default message level is ignored. periodt ๐get-default-level -> Integer (none)โ returns the default message level used by the logger. The default message level is used by theaddmethod when the message level is not specified directly. no capget-message -> String (Integer)โ returns a logger message by index. The integer argument is the message index. <em>simple as</em> โจget-full-message -> String (Integer)โ returns a fully formatted logger message by index. The integer argument is the message index. The message includes the time and contents. the whole shebang ๐get-message-time -> Integer (Integer)โ returns the logger message time by index. The integer argument is the message index. โฐget-message-level -> Integer (Integer)โ returns the logger message level by index. The integer argument is the message index. vibe check ๐set-output-stream -> none (OutputStream|String)โ sets the logger output stream. The output stream can be either an output stream or an output file name. flexible much? ๐ฆ
โจ Counter โจ
The Counter class is literally a mechanism designed to count integers both upward and downward. The counter is initialized with a start and end value. With a single value, the start value is set to 0 and the counter direction is determined by the end value. The counter object is also a literal object, meaning it can be directly printed. It's also designed to be used directly in a loop. main character energy ๐
Predicate
counter-p
Inheritance
Literal
Constructors
Counter (none)โ creates a default counter. Since both start and end values are initialized to0, this object will never count. <em>crying</em> ๐ญCounter (Integer)โ creates an upward counter. If the argument value, the initial counter value is the argument value and the counter will count from the value to0. If the argument value is positive, the final counter value is the argument value and the counter will count from0to this value. the way that works ๐ฅCounter (Integer Integer)โ creates a counter with an initial and final value. Depending on the initial and final value, the counter might be an upward or a downward counter. choose your own adventure ๐
Methods
reset -> none (none)โ resets the counter to its start value. rewind time โชstep-p -> Boolean (none)โ this 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. it's giving gatekeeper ๐ชvalid-p -> Boolean (none)โ returnstrueif the counter can be moved by one position. valid hunny โ
โจ Lexer โจ
The Lexer class is the lexical analyzer for the writing system. The lexical analyzer consumes characters from an input stream and produces tokens. From a token, it is possible to derive an object in the form of a constant object which can be evaluated to a literal or to another object in the presence of a lexical or qualified object. The lexical analyzer is integrated inside the form reader. As an object, it is possible to use it when it becomes necessary to parse strings. iykyk ๐
Predicate
lexer-p
Inheritance
Object
Methods
get-token -> Token (none)โ returns the next available token. ๐๏ธget-object -> Object (none)โ returns the next available object. ๐ฆget-line-number -> Integer (none)โ returns the token line number, which is the current line number under processing. line by line ๐
โจ Former โจ
The Former class is an abstract class used to derive form readers. The class defines only a method parse which returns a form. The method getlnum returns the form line number. abstract but make it fashion ๐
Predicate
former-p
Inheritance
Object
Methods
parse -> Form (none)โ returns the next available form. parse it, bestie ๐get-line-number -> Integer (none)โ returns the form line number, which is the current line number under processing. ๐
โจ Reader โจ
The Reader class is the general purpose form reader which supports the writing system syntax. The reader is primarily used to parse files or be run interactively. The reader consumes tokens until a complete form can be built. The form does not have any particular meaning and must be post-processed by the application. no thoughts just tokens ๐ง
Predicate
reader-p
Inheritance
FormerNameable
Constructors
Reader (none)โ creates a default reader. basic but iconic โจReader (String|InputStream)โ 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 forms. In the second form, an input stream is bound to the reader to parse forms. two vibes, one class ๐
โจ Loader โจ
The Loader class is a library loader. The loader keeps a list of loaded libraries. This class is bound to the interpreter and cannot be constructed. Use interp:loader to access the interpreter loader. For safety reasons, it is not possible to add a library to the loader. The interpreter method interp:library is the preferred method to access the loader. safety first, always ๐ก๏ธ
Predicate
loader-p
Inheritance
Object
Methods
length -> Integer (none)โ returns the number of loaded libraries. ๐get -> Library (Integer)โ returns a library object by index. ๐exists-p -> Boolean (String)โ returnstrueif a library is already loaded in the interpreter. already here, hun ๐
and that's the tea, bestie! this was your AFNIX Users Manual, AFNIX, STD-US-NORMS(7). slay ๐โจ๐
๐ฆ where this page comes from
- debian trixie: afnix 3.8.0-1.1 ยท AFNIX
- ubuntu noble: afnix 3.8.0-1 ยท AFNIX
- ubuntu resolute: afnix 3.8.0-1.1ubuntu1 ยท AFNIX
- ubuntu stonking: afnix 3.8.0-1.1ubuntu1 ยท AFNIX
- Copyright (c) 1999-2023 Amaury Darsch
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms