7.7
3.9 ASCII
(require cur/stdlib/ascii) | package: cur-lib |
This library defines ASCII characters and strings, and a #%datum
extension for ASCII string literals.
A datatype representing an ASCII character, as a bit vector.
Examples:
> (define zero (ascii false false false false false false false)) > (define one (ascii false false false false false false true)) > "" (nil (Ascii))
> "1" (cons (Ascii) (ascii (false) (true) (true) (false) (false) (false) (true)) (nil (Ascii)))
type
procedure
(ascii-str-concat str1 str2) → Ascii-Str
str1 : Ascii-Str str2 : Ascii-Str
Concatenates two strings, appending str2 to the end of str1.
procedure
(ascii-str-length str) → Nat
str : Ascii-Str
Returns the length of the string str.
procedure
(meta-ascii->ascii syn char) → syntax?
syn : (or/c syntax? #f) char : ascii-char?
A meta-procedure, provided at phase 1, for converting a Racket (meta-level)
ascii-char? into syntax representing an Ascii. If syn
is provided, it is used in error messages in the even that char is not
an ascii-char?.
procedure
(meta-string->ascii-str syn str) → syntax?
syn : (or/c syntax? #f) str : ascii-string?
A meta-procedure, provided at phase 1, for converting a Racket (meta-level)
ascii-string? into syntax representing an Ascii-Str.
If syn is provided, it is used in error messages in the even that
str is not an ascii-string?.
procedure
(ascii-datum syn f) → syntax?
syn : syntax? f : procedure?
A meta-procedure, provided at phase 1, for parsing ASCII string literals.
This module automatically updates #%datum using this procedure.
Examples:
> "" (nil (Ascii))
> "1" (cons (Ascii) (ascii (false) (true) (true) (false) (false) (false) (true)) (nil (Ascii)))
procedure
(ascii->meta-ascii syn) → ascii-char?
syn : syntax?
A meta-procedure, provided at phase 1, for converting syntax representing a
Ascii literal into a Racket (meta-level) ascii-char?.
procedure
(ascii-str->meta-string syn) → ascii-string?
syn : syntax?
A meta-procedure, provided at phase 1, for converting syntax representing a
Ascii-Str literal into a Racket (meta-level) ascii-string?.