-
Notifications
You must be signed in to change notification settings - Fork 4
rune
A rune is a single Unicode character like A, x, λ, א, or 象.
This name was stolen from Go.
Rune literals are preceded by a ****, so the above would appear as \A, \x, \λ, \א, and \象.
There are special rune literals for whitespace: \space, \tab, \lf, and \cr.
(rune? x) -> true if x is a rune
(rune? \x) -> true
(rune? "x") -> false
(rune? \lf) -> true
(rune? \7) -> true
(rune? 7) -> false
x.type -> rune
x.view -> x
x.alpha? -> true if x is alphabetic, false otherwise
x.digit? -> true if x is numeric, false otherwise
x.whitespace? -> true if x is whitespace, false otherwise
x.uc? -> true if x is uppercase
x.lc? -> true if x is lowercase
x.code -> returns the Unicode code point of the rune, in decimal.
x.to-bool -> true
x.to-number -> returns the rune as an integer. Works only for digital runes.
x.to-text -> returns a text with the single character: \a -> "a", \lf -> "\n"
x.uc -> return uppercase version of rune: \a -> \A
x.lc -> return lowercase version of rune: \A -> \a