Skip to content
Turtle Kitty edited this page Jan 28, 2016 · 7 revisions

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.

predicate

(rune? x) -> true if x is a rune

(rune? \x) -> true
(rune? "x") -> false
(rune? \lf) -> true
(rune? \7) -> true
(rune? 7) -> false

messages

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

Clone this wiki locally