Solan reference

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

NameArgumentsSource-confirmed behavior
طولpropertyUTF-8 character count.
قسم(separator?)0–1Without a separator, splits on ASCII whitespace; empty separator splits characters; otherwise splits on the supplied string.
سطور()0Returns lines; strips CR before LF.
نظف()0Trims space, tab, LF, and CR at both ends.
كبير() / صغير()0Changes ASCII a-z/A-Z only; does not implement Unicode case conversion for Arabic.
يبدأ_ب(text) / ينتهي_ب(text)1Prefix or suffix check.
يحتوي(text)1Substring check; the empty string is present.
ابدل(old, new)2Replaces all non-overlapping matches; an empty old string returns the original.
جزء(start, end?)1–2Character slice with exclusive end; bounds are clipped.
ابحث(text)1Character offset of the match, or -1.
كرر(count)1Repeats the string; count must be integral and output is capped at 512 MiB.
اعكس() / حروف()0Reverses characters or returns a list of UTF-8 characters.
نسق(...)formatter-definedDelegates to the source formatter.
املأ_يسار(width, pad?) / املأ_يمين(...)1–2Pads 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

NameArgumentsSource-confirmed behavior
طولpropertyNumber of elements.
اضف(...items)0+Mutates and returns the same list.
ادرج(index, value)2Inserts at an index; negative indexes are accepted within bounds.
احذف(index)1Removes and returns the element; invalid indexes raise an error.
اسحب()0Pops the last element, or returns nil for an empty list.
ادمج(separator?)0–1Converts items to strings and joins them; default separator is empty.
اعكس() / رتب(comparator?)0 / 0–1Mutate and return the list; comparator must return a number.
حول(fn) / رشح(fn)1Return a new mapped or filtered list.
اطوي(fn, initial?)1–2Reduces the list; an empty list without an initial value is an error.
نفذ(fn)1Calls the function for each element and returns nil.
جد(fn)1Returns the first matching element, or nil.
اي(fn) / كل(fn)1Tests whether any/all elements are truthy; short-circuits.
انسخ() / امسح()0Copies to a new list or clears the receiver.
مجموع()0Sums numbers only; a non-number raises an error.
ابحث(value) / يحتوي(value)1Returns the first equal value index or tests membership.
احصل(index, default?)1–2Returns the item at the index or the default/nil.
اول() / اخر()0First/last item, or nil for an empty list.
سطّح() / فريد()0Flattens one list level or returns unique items in encounter order.
جزء(start, end?)1–2Returns a new slice with an exclusive end.

Maps

Map methods

NameArgumentsSource-confirmed behavior
طولpropertyNumber of live keys.
مفاتيح() / قيم() / ازواج()0Lists of keys, values, or [key, value] pairs.
يحتوي(key)1Checks whether the key exists.
احصل(key, default?)1–2Returns the value or default/nil.
احذف(key)1Removes and returns the prior value, or nil.
انسخ() / امسح()0Copies a map or clears and returns the receiver.
دمج(map)1Mutates 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.