Built-in Methods by Value Type
A receiver-specific reference to built-in string, list, and map methods, matched from mids.inc to their VM implementations.
Principles
Method availability depends on the receiver
src/vm/mids.inc registers Arabic method names, while builtin_method dispatches by receiver type: string, list, or map. A name in the global method table is not automatically available on all three types; unsupported receiver/method combinations are rejected.
Argument counts below are the source-enforced arity, not a complete type signature. Property-style methods such as طول are used without parentheses.
Strings
String methods
| Name | Arguments | Source-confirmed behavior |
|---|---|---|
طول | property | UTF-8 character count. |
قسم(separator?) | 0–1 | Without a separator, splits on ASCII whitespace; empty separator splits characters; otherwise splits on the supplied string. |
سطور() | 0 | Returns lines; strips CR before LF. |
نظف() | 0 | Trims space, tab, LF, and CR at both ends. |
كبير() / صغير() | 0 | Changes ASCII a-z/A-Z only; does not implement Unicode case conversion for Arabic. |
يبدأ_ب(text) / ينتهي_ب(text) | 1 | Prefix or suffix check. |
يحتوي(text) | 1 | Substring check; the empty string is present. |
ابدل(old, new) | 2 | Replaces all non-overlapping matches; an empty old string returns the original. |
جزء(start, end?) | 1–2 | Character slice with exclusive end; bounds are clipped. |
ابحث(text) | 1 | Character offset of the match, or -1. |
كرر(count) | 1 | Repeats the string; count must be integral and output is capped at 512 MiB. |
اعكس() / حروف() | 0 | Reverses characters or returns a list of UTF-8 characters. |
نسق(...) | formatter-defined | Delegates to the source formatter. |
املأ_يسار(width, pad?) / املأ_يمين(...) | 1–2 | Pads with the supplied string (space by default) to the requested width. |
Length and offsets follow the source UTF-8 character helpers. كبير and صغير perform ASCII-only case conversion.
Lists
List methods
| Name | Arguments | Source-confirmed behavior |
|---|---|---|
طول | property | Number of elements. |
اضف(...items) | 0+ | Mutates and returns the same list. |
ادرج(index, value) | 2 | Inserts at an index; negative indexes are accepted within bounds. |
احذف(index) | 1 | Removes and returns the element; invalid indexes raise an error. |
اسحب() | 0 | Pops the last element, or returns nil for an empty list. |
ادمج(separator?) | 0–1 | Converts items to strings and joins them; default separator is empty. |
اعكس() / رتب(comparator?) | 0 / 0–1 | Mutate and return the list; comparator must return a number. |
حول(fn) / رشح(fn) | 1 | Return a new mapped or filtered list. |
اطوي(fn, initial?) | 1–2 | Reduces the list; an empty list without an initial value is an error. |
نفذ(fn) | 1 | Calls the function for each element and returns nil. |
جد(fn) | 1 | Returns the first matching element, or nil. |
اي(fn) / كل(fn) | 1 | Tests whether any/all elements are truthy; short-circuits. |
انسخ() / امسح() | 0 | Copies to a new list or clears the receiver. |
مجموع() | 0 | Sums numbers only; a non-number raises an error. |
ابحث(value) / يحتوي(value) | 1 | Returns the first equal value index or tests membership. |
احصل(index, default?) | 1–2 | Returns the item at the index or the default/nil. |
اول() / اخر() | 0 | First/last item, or nil for an empty list. |
سطّح() / فريد() | 0 | Flattens one list level or returns unique items in encounter order. |
جزء(start, end?) | 1–2 | Returns a new slice with an exclusive end. |
Maps
Map methods
| Name | Arguments | Source-confirmed behavior |
|---|---|---|
طول | property | Number of live keys. |
مفاتيح() / قيم() / ازواج() | 0 | Lists of keys, values, or [key, value] pairs. |
يحتوي(key) | 1 | Checks whether the key exists. |
احصل(key, default?) | 1–2 | Returns the value or default/nil. |
احذف(key) | 1 | Removes and returns the prior value, or nil. |
انسخ() / امسح() | 0 | Copies a map or clears and returns the receiver. |
دمج(map) | 1 | Mutates the receiver; incoming values replace matching keys. |
Arabic names match src/vm/mids.inc; arity and behavior come from the corresponding branches in src/vm/methods.inc.
Principles
Reference limits
This page documents registration and implementation visible in the source. Some conversions depend on the VM or callbacks; examples were not executed in this task. Verify syntax on your installed version with solan --check.
Source files
Direct links pinned to the source snapshot used by this reference; the main branch may change later.