2021-01-21 13:40:28 +01:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
|
|
<title>.</title>
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
* { color: #000; background: #fff; max-width: 700px; }
|
|
|
|
tt, pre { background: #dedede; color: #111; font-family: monospace;
|
|
|
|
white-space: pre; display: block; width: 100%; }
|
|
|
|
.indentedcode { margin-left: 2em; margin-right: 2em; }
|
|
|
|
.codeblock {
|
|
|
|
background: #dedede; color: #111; font-family: monospace;
|
|
|
|
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
|
|
padding: 7px;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.indentedlist { margin-left: 2em; color: #000; }
|
|
|
|
|
|
|
|
span { white-space: pre; }
|
|
|
|
.text { color: #000; white-space: pre; background: #dedede; }
|
|
|
|
.colon { color: #000; background: #dedede; }
|
|
|
|
.note { color: #000; background: #dedede; }
|
|
|
|
.str { color: #000; text-decoration: underline; background: #dedede; }
|
|
|
|
.num { color: #000; background: #dedede; font-weight: bold; font-style: italic; }
|
|
|
|
.fnum { color: #000; font-weight: bold; background: #dedede; }
|
|
|
|
.ptr { color: #000; font-weight: bold; background: #dedede; }
|
|
|
|
.fetch { color: #000; font-style: italic; background: #dedede; }
|
|
|
|
.store { color: #000; font-style: italic; background: #dedede; }
|
|
|
|
.char { color: #000; background: #dedede; }
|
|
|
|
.inst { color: #000; background: #dedede; }
|
|
|
|
.defer { color: #000; background: #dedede; }
|
|
|
|
.imm { color: #000; font-weight: bold; background: #dedede; }
|
|
|
|
.prim { color: #000; font-weight: bolder; background: #dedede; }
|
|
|
|
|
|
|
|
.tt { white-space: pre; font-family: monospace; background: #dedede; }
|
|
|
|
|
|
|
|
.h1, .h2, .h3, .h4 { white-space: normal; }
|
|
|
|
.h1 { font-size: 125%; }
|
|
|
|
.h2 { font-size: 120%; }
|
|
|
|
.h3 { font-size: 115%; }
|
|
|
|
.h4 { font-size: 110%; }
|
|
|
|
.hr { display: block; height: 2px; background: #000000; }
|
|
|
|
</style>
|
|
|
|
</head><body>
|
2022-06-03 12:41:52 +02:00
|
|
|
<p><br/><br/>
|
2021-01-21 13:40:28 +01:00
|
|
|
RETRO provides words for working with ASCII characters.
|
|
|
|
<br/><br/>
|
2021-03-30 13:58:25 +02:00
|
|
|
<span class="h2">Sigil</span>
|
2021-01-21 13:40:28 +01:00
|
|
|
<br/><br/>
|
2021-03-30 13:58:25 +02:00
|
|
|
Character constants are returned using the <span class="tt">$</span> sigil.
|
2021-01-21 13:40:28 +01:00
|
|
|
<br/><br/>
|
|
|
|
<span class="h2">Namespace</span>
|
|
|
|
<br/><br/>
|
|
|
|
Words operating on characters are in the <span class="tt">c:</span> namespace.
|
|
|
|
<br/><br/>
|
|
|
|
<span class="h2">Classification</span>
|
|
|
|
<br/><br/>
|
|
|
|
RETRO provides a number of words to determine if a character
|
|
|
|
fits into predefined groups.
|
|
|
|
<br/><br/>
|
|
|
|
The primary words for this are:
|
|
|
|
<br/><br/>
|
|
|
|
• <span class="tt">c:consonant?</span><br/>
|
|
|
|
• <span class="tt">c:digit?</span><br/>
|
|
|
|
• <span class="tt">c:letter?</span><br/>
|
|
|
|
• <span class="tt">c:lowercase?</span><br/>
|
|
|
|
• <span class="tt">c:uppercase?</span><br/>
|
|
|
|
• <span class="tt">c:visible?</span><br/>
|
|
|
|
• <span class="tt">c:vowel?</span><br/>
|
|
|
|
• <span class="tt">c:whitespace?</span><br/>
|
|
|
|
<br/><br/>
|
|
|
|
There are also corresponding "not" forms:
|
|
|
|
<br/><br/>
|
|
|
|
• <span class="tt">c:-consonant?</span><br/>
|
|
|
|
• <span class="tt">c:-digit?</span><br/>
|
|
|
|
• <span class="tt">c:-lowercase?</span><br/>
|
|
|
|
• <span class="tt">c:-uppercase?</span><br/>
|
|
|
|
• <span class="tt">c:-visible?</span><br/>
|
|
|
|
• <span class="tt">c:-vowel?</span><br/>
|
|
|
|
• <span class="tt">c:-whitespace?</span><br/>
|
|
|
|
<br/><br/>
|
|
|
|
All of these take a character and return either a <span class="tt">TRUE</span> or
|
|
|
|
<span class="tt">FALSE</span> flag.
|
|
|
|
<br/><br/>
|
|
|
|
<span class="h2">Conversions</span>
|
|
|
|
<br/><br/>
|
|
|
|
A few words are provided to convert case. Each takes a character
|
|
|
|
and returns the modified character.
|
|
|
|
<br/><br/>
|
|
|
|
• <span class="tt">c:to-lower</span><br/>
|
|
|
|
• <span class="tt">c:to-number</span><br/>
|
|
|
|
• <span class="tt">c:to-upper</span><br/>
|
|
|
|
• <span class="tt">c:toggle-case</span><br/>
|
|
|
|
<br/><br/>
|
|
|
|
RETRO also has <span class="tt">c:to-string</span>, which takes a character and
|
|
|
|
creates a new temporary string with the character.
|
|
|
|
<br/><br/>
|
|
|
|
<span class="h2">I/O</span>
|
|
|
|
<br/><br/>
|
|
|
|
Characters can be displayed using <span class="tt">c:put</span>.
|
|
|
|
<br/><br/>
|
|
|
|
<span class='codeblock'><span class="tt">```</span><br/><span class="tt"><span class='char'>$a</span> c:put </span><br/>
|
|
|
|
<span class="tt">```</span></span><br/><br/>
|
|
|
|
With the default system on BSD, Linux, and macOS (and other
|
|
|
|
Unix style hosts), <span class="tt">c:get</span> is provided to read input. This
|
|
|
|
may be buffered, depending on the host.
|
|
|
|
</p>
|
|
|
|
</body></html>
|