This is a configurable lexicographic position based algorithm, used to get the core, next or previous number for a nth base number system.
This project was created with the intention to solve
You can pass as settings the options to create the best system that fits your needs.
import { staquia } from "staquia";
// This example has an 27th base number set [a - z]
staquia.setup({
// z
zero: "!",
// sf
first: "a",
// s0
last: "z",
// kappa
ϰ: 0.15,
// `n` and `z`
segments: {
n: 5,
z: 15,
},
});
Note: All of the following examples are shown using the above system in the example.
Is an object that represents a position
that can be used either on on a table or a stack.
This contains functions to get the next, previous or even the core position that lays between this and another position.
The system from this position is based on a string that contains two sections, the n
part and the z
part.
This uses the property of string comparison where depending on the unicode number that represents the character, this may be bigger or smaller than other.
// Unicode \u0061 (61)
const a = "a";
// Unicode \u0062 (62)
const b = "b";
// Will print true as 61 < 62
console.log(a < b);
n
This section was designed with the sole purpose the to move up or down one position when the next
or previous
algorithm is used.
import { staquia } from "staquia";
// This example uses the 27th base number set [a - z]
const xy = staquia.position("xy");
const xz = xy.next();
// Prints - The following character is !!xz"
console.log("The following character is " & xz);
// This example uses the 27th base number set [a - z] with character zero as !
const b0 = staquia.position("b!");
const az = b0.previous();
// Prints - The previous character is !!az"
console.log("The previous character is " & az);
z
This section was designed with the sole purpose the to go to the mid value from two positions when the core
algorithm is used.
import { staquia } from "staquia";
// This example uses the 27th base number set [a - z]
const a = staquia.position("a");
const b = staquia.position("b");
const am = a.core(b);
// Prints - The following character is !!!am"
console.log("The following character is ", am);
Above explains how the position systems works but there is more if you want to get the full power from this algorithm please visit documentation site.
Generated using TypeDoc