-with / -val Arguments
Explains and demonstrates Ragul's instrument suffix (-val / -with / -&), which supplies an extra argument to a suffix from a separate word in the sentence.
Inline vs. sentence-level arguments
There are two ways to pass an argument to a suffix:
| Form | Example | When to use |
|---|---|---|
| Inline (baked into the chain) | s-"Hello"-contains-it |
The argument is a literal known at write time |
-with (separate sentence word) |
s-contains-it word-with. |
The argument is a variable, computed value, or too long to inline |
Both forms are semantically identical — the choice is purely about readability.
1. Arithmetic with a variable argument
2. String operations
Multiple -with arguments are consumed left-to-right by the suffixes that need them.
program-ours-effect
sentence-into "Hello, Ragul!"-it.
sep-into ", "-it.
// Contains — search term from a variable
word-into "Ragul"-it.
found-into sentence-contains-it word-with.
found-print-doing. // True
// Split — separator from a variable
parts-into sentence-split-it sep-with.
parts-print-doing. // ['Hello', 'Ragul!']
// Replace — two -with arguments in sequence
old_word-into "Ragul"-it.
new_word-into "world"-it.
changed-into sentence-replace-it old_word-with new_word-with.
changed-print-doing. // Hello, world!
program-nk-hatás
mondat-ba "Szia, Ragul!"-t.
elvalaszto-ba ", "-t.
// Tartalmaz — a keresett szó változóból
szoveg-ba "Ragul"-t.
van-ba mondat-tartalmaz-t szoveg-val.
van-képernyőre-va. // True
// Szétválasztás — az elválasztó változóból
szavak-ba mondat-feloszt-t elvalaszto-val.
szavak-képernyőre-va. // ['Szia', 'Ragul!']
// Csere — két -val argumentum egymás után
regi-ba "Ragul"-t.
uj-ba "világ"-t.
modositott-ba mondat-csere-t regi-val uj-val.
modositott-képernyőre-va. // Szia, világ!
3. User-defined scopes with multiple parameters
When a scope is called as a suffix, the first -yours (-d) parameter receives the piped-in value; all subsequent parameters receive -with arguments left-to-right.
4. Fold (reduce) with an initial accumulator
A -fold (-gyűjt) scope reduces a list to a single value. The initial accumulator is supplied as the first -with argument in the calling sentence.
The scope receives two -yours parameters: the first is the accumulator, the second is the current element.
Output:
Suffix aliases
| Canonical | English alias | Symbol |
|---|---|---|
-val / -vel |
-with |
-& |
The front-vowel harmonic variant -vel is accepted anywhere -val appears (vowel harmony with the root).
Key rules
-withwords are consumed left-to-right by suffixes that need arguments, in chain order.- An inline argument (e.g.
-3-add) and a-withargument fill the same slot — they are interchangeable for numeric and string literals. - For fold scopes, the possession order in the scope header is
name-ours-fold(-unk-gyűjt), notname-fold-ours.