Functions & Scopes
Scopes Are Suffixes
A named scope and a custom suffix are the same thing. Defining a named scope simultaneously defines a suffix that can be applied anywhere. There is no separate function declaration syntax.
This definition makes -kétszeres immediately available as an aspect suffix:
Parameters
Parameters are roots marked with -d / -yours (passed in). They receive values from the calling sentence via -val / -with bindings, in left-to-right order:
With type annotations:
Return Value
The final unnamed result root of a scope is its return value — no explicit return keyword needed:
Scope and Binding
Indentation as Scope
Ragul uses indentation (tabs) to define scope boundaries. Roots defined within a scope cease to exist when that scope closes:
Nested Scopes
Scopes nest freely. Inner scopes can reference roots from outer scopes, but not vice versa:
Possession Suffixes
Possession suffixes express explicit ownership when needed. Scoping is implicit by default — indentation handles it.
| Hungarian | English | Meaning |
|---|---|---|
| (implicit) | — | Belongs to current scope (default) |
-unk / -nk |
-ours |
Explicitly owned by this scope |
-m / -em |
-mine |
Immutable within this scope |
-d / -ed |
-yours |
Passed in from outer scope (parameter) |
-ja / -je |
-its |
Belongs to / references another root |
Usage mirrors this. in languages like C# — available when needed, not required:
Conceptual Mapping
| Traditional concept | Ragul equivalent |
|---|---|
| Function definition | Named scope (-unk / -ours) |
| Function call | Suffix in a chain |
| Parameters | -d / -yours roots inside the scope |
| Return value | Final result root |
| Composition | Suffix stacking |
| Modules | Nested scopes (-modul / -module) |
| Type annotation | -ként / -as on -d roots and return |
A Complete Example
A small library of annotated suffixes:
// Numeric operations
kétszeres-ours
szám-yours Num-as.
szám-szám-add-it Num-as.
felére-ours
szám-yours Num-as.
szám-2-div-it Num-as.
// Threshold filter
szűrőhatár-ours
lista-yours List-as.
threshold-yours Num-as.
lista-filter-from threshold-above-with obj List-as.
// Fallible file reader
fájlolvasó-ours
path-yours Str-as.
path-fájlról-from read-doing-it or-Str-or-Err-as.
// Numeric operations
kétszeres-unk
szám-d Szám-ként.
szám-szám-össze-t Szám-ként.
felére-unk
szám-d Szám-ként.
szám-2-oszt-t Szám-ként.
// Threshold filter
szűrőhatár-unk
lista-d Lista-ként.
küszöb-d Szám-ként.
lista-szűrve-ből küszöb-felett-val t Lista-ként.
// Fallible file reader
fájlolvasó-unk
útvonal-d Szöveg-ként.
útvonal-fájlról-ből olvas-va-t vagy-Szöveg-vagy-Hiba-ként.
Calling these is unchanged — annotations are invisible at the call site: