Prelude
Built-in methods on core types (spec §14). Filter by receiver type or search by name.
Textlen() -> IntNumber of Unicode scalar values.Textupper() -> TextUppercased copy.Textlower() -> TextLowercased copy.Texttrim() -> TextCopy without surrounding whitespace.Textcontains(Text) -> BoolWhether the substring occurs.Textstarts_with(Text) -> BoolPrefix test.Textends_with(Text) -> BoolSuffix test.Textsplit(Text) -> List[Text]Split at a separator; empty separator is a runtime error — use chars().Textreplace(Text, Text) -> TextReplace every occurrence.Textchars() -> List[Text]One-character texts, by Unicode scalar.Textto_int() -> Option[Int]Exact parse — None on anything else. Combine with trim().Textto_float() -> Option[Float]Exact parse to Float.Intabs() -> IntAbsolute value; overflow on I64 min is a runtime error.Intto_float() -> FloatLossless-ish conversion to Float.Floatabs() -> FloatAbsolute value.Floatsqrt() -> FloatSquare root (IEEE-754).Floatsin() -> FloatSine (radians) — added for the audio stdlib.Floatcos() -> FloatCosine (radians).Floatround() -> IntRound half away from zero; non-finite values error.Floatfloor() -> IntRound down.Floatceil() -> IntRound up.Floatto_int() -> IntTruncate toward zero.Listlen() -> IntElement count.Listis_empty() -> BoolWhether the list has no elements.Listcontains(T) -> BoolStructural membership test.Listfirst() -> Option[T]Safe head — None when empty. Prefer over xs[0].Listlast() -> Option[T]Safe tail element.Listreversed() -> List[T]Reversed copy.Listsorted() -> List[T]Sorted copy; elements must be Int, Float, or Text.Listjoin(Text) -> TextConcatenate a List[Text] with a separator.Listmap(fn(T) -> U) -> List[U]New list with the function applied to each element (§16).Listfilter(fn(T) -> Bool) -> List[T]Keep the elements the predicate accepts.Listfold(U, fn(U, T) -> U) -> UThread an accumulator left to right.Listpush(T) mutAppend in place; the receiver's root must be mut.Maplen() -> IntEntry count.Mapis_empty() -> BoolWhether the map has no entries.Maphas(K) -> BoolKey membership test.Mapget(K) -> Option[V]Safe lookup — m[k] on a missing key errors, m.get(k) never does.Mapkeys() -> List[K]Keys in insertion order — iterate maps via for k in m.keys().Mapvalues() -> List[V]Values in insertion order.Setlen() -> IntElement count.Setis_empty() -> BoolWhether the set is empty.Setcontains(T) -> BoolMembership test.Setadd(T) mutInsert in place; duplicates collapse.Optionis_some() -> BoolWhether a value is present.Optionis_none() -> BoolWhether the option is empty.Optionunwrap_or(T) -> TThe value, or the given default.Resultis_ok() -> BoolWhether the result is Ok.Resultis_err() -> BoolWhether the result is Err.Resultunwrap_or(T) -> TThe Ok value, or the given default.