Strings
Strings are immutable, efficient, Unicode sequences of characters.
c singleton → String | c is-a?: Character
Creates a String
containing a single character.
Example:
> $a singleton "a"
l to: String → String | l is-a?: List
Attempts to convert a list to a string. If the list does not contain only Character
s, @list-not-homogenous
is signaled.
s at: index → Character | s is-a?: String | index is-a?: Integer
Returns the string's character at index
. If the index is out of bounds, @(out-of-bounds: index for-string: s)
is raised.
s head → any | s is-a?: String
Returns the first character of the string. If the string is empty, @empty-string
is raised.
Example:
> "abc" head $a
s last → any | s is-a?: String
Returns the last character of the string. If the string is empty, @empty-string
is raised.
Example:
> "abc" last $c