🐐 QVAERE

This commit is contained in:
2026-04-22 09:08:36 +02:00
parent ebea9f942b
commit b9a1ed1bcc
12 changed files with 84 additions and 281 deletions

View File

@@ -349,6 +349,11 @@ Returns the type of `value` as a string: `NVMERVS` (integer), `LITTERA` (string)
Sleeps for `n` seconds, where `n` is an integer, fraction, or NVLLVS (treated as 0). Returns nothing meaningful.
### QVAERE
`QVAERE(pattern, string)`
Returns an array of all non-overlapping matches of the regex `pattern` in `string`. Both arguments must be strings. Patterns use extended regular expression syntax. Returns an empty array if there are no matches. Raises an error if the pattern is invalid.
## Modules
Modules are additions to the base `CENTVRION` syntax. They add or change certain features. Modules are included in your code by having
@@ -361,15 +366,15 @@ Vnlike many other programming languages with modules, the modules in `CENTVRION`
### FORS
![CVM FORS](snippets/fors.png)
The `FORS` module allows you to add randomness to your `CENTVRION` program. It adds 4 new built-in functions: `FORTVITVS_NVMERVS int int`, `FORTVITA_ELECTIO ['a]`, `DECIMATIO ['a]`, and `SEMEN int`.
The `FORS` module allows you to add randomness to your `CENTVRION` program. It adds 4 new built-in functions: `FORTVITVS_NVMERVS(int, int)`, `FORTVITA_ELECTIO(['a])`, `DECIMATIO(['a])`, and `SEMEN(int)`.
`FORTVITVS_NVMERVS int int` picks a random int in the (inclusive) range of the two given ints.
`FORTVITVS_NVMERVS(int, int)` picks a random int in the (inclusive) range of the two given ints.
`FORTVITA_ELECTIO ['a]` picks a random element from the given array. `FORTVITA_ELECTIO array` is identical to ```array[FORTVITVS_NVMERVS NVLLVS ((LONGITVDO array)-I)]```.
`FORTVITA_ELECTIO(['a])` picks a random element from the given array. `FORTVITA_ELECTIO(array)` is identical to ```array[FORTVITVS_NVMERVS NVLLVS ((LONGITVDO array)-I)]```.
`DECIMATIO ['a]` returns a copy of the given array with a random tenth of its elements removed. Arrays with fewer than 10 elements are returned unchanged.
`DECIMATIO(['a])` returns a copy of the given array with a random tenth of its elements removed. Arrays with fewer than 10 elements are returned unchanged.
`SEMEN int` seeds the random number generator for reproducibility.
`SEMEN(int)` seeds the random number generator for reproducibility.
### FRACTIO
![CVM FRACTIO](snippets/fractio.png)
@@ -394,14 +399,15 @@ When `_` is added _after_ a numeric symbol, the symbol becomes 1.000 times large
All integer symbols except `I` may be given a `_`.
### SCRIPTA
![CVM SCRIPTA](snippets/scripta.png)
The `SCRIPTA` module adds file I/O to your `CENTVRION` program. It adds 3 new built-in functions: `LEGE string`, `SCRIBE string string`, and `ADIVNGE string string`.
The `SCRIPTA` module adds file I/O to your `CENTVRION` program. It adds 3 new built-in functions: `LEGE`, `SCRIBE`, and `ADIVNGE`.
`LEGE string` reads the contents of the file at the given path and returns them as a string.
`LEGE(string)` reads the contents of the file at the given path and returns them as a string.
`SCRIBE string string` writes the second argument to the file at the path given by the first argument, overwriting any existing content.
`SCRIBE(string, string)` writes the second argument to the file at the path given by the first argument, overwriting any existing content.
`ADIVNGE string string` appends the second argument to the file at the path given by the first argument.
`ADIVNGE(string, string)` appends the second argument to the file at the path given by the first argument.
### SVBNVLLA
![CVM SVBNVLLA](snippets/svbnvlla.png)