Tanstore
Jump to navigation
Jump to search
Tanstore stands for Tommyaweosme's alphanumeric storage unit.
Possible values
0 (space) 1-26 alphabet 27-36 numberbet 37 (newline)
A more explicit listing comprehending the recognized symbols and their affiliated Tanstore character codes may be extracted from the following tabulation:
Code | Character | Category |
---|---|---|
0 | (space) | (space) |
1 | A | alphabet |
2 | B | alphabet |
3 | C | alphabet |
4 | D | alphabet |
5 | E | alphabet |
6 | F | alphabet |
7 | G | alphabet |
8 | H | alphabet |
9 | I | alphabet |
10 | J | alphabet |
11 | K | alphabet |
12 | L | alphabet |
13 | M | alphabet |
14 | N | alphabet |
15 | O | alphabet |
16 | P | alphabet |
17 | Q | alphabet |
18 | R | alphabet |
19 | S | alphabet |
20 | T | alphabet |
21 | U | alphabet |
22 | V | alphabet |
23 | W | alphabet |
24 | X | alphabet |
25 | Y | alphabet |
26 | Z | alphabet |
27 | 0 | numberbet |
28 | 1 | numberbet |
29 | 2 | numberbet |
30 | 3 | numberbet |
31 | 4 | numberbet |
32 | 5 | numberbet |
33 | 6 | numberbet |
34 | 7 | numberbet |
35 | 8 | numberbet |
36 | 9 | numberbet |
37 | (newline) | (newline) |
Implementations
An peirastic implementation of an encoder and decoder in the Common Lisp programming language shall be adduced below:
(deftype tanstore-code () "Defines the valid integral range for Tanstore character codes." '(integer 0 37)) ;;; ------------------------------------------------------- (deftype destination () "Defines a sink for output operations." '(or null (eql T) stream string)) ;;; ------------------------------------------------------- (define-condition Tanstore-Error (error) () (:documentation "Furnishes the firmament for all Tanstore-related errors.")) ;;; ------------------------------------------------------- (define-condition No-Tanstore-Character-Error (Tanstore-Error) ((offending-character :initarg :offending-character :initform (error "Missing offending character.") :reader no-tanstore-character-error-offending-character :type character :documentation "The non-Tanstore symbol.")) (:report (lambda (condition stream) (declare (type No-Tanstore-Character-Error condition)) (declare (type destination stream)) (format stream "No Tanstore symbol: ~c." (no-tanstore-character-error-offending-character condition)))) (:documentation "Communicates the attempt to request a non-Tanstore symbol.")) ;;; ------------------------------------------------------- (define-condition Invalid-Tanstore-Code-Error (Tanstore-Error) ((offending-code :initarg :offending-code :initform (error "Missing offending code.") :reader invalid-tanstore-code-error-offending-code :type integer :documentation "The number representing no valid Tanstore code.")) (:report (lambda (condition stream) (declare (type Invalid-Tanstore-Code-Error condition)) (declare (type destination stream)) (format stream "No valid Tanstore code: ~d." (invalid-tanstore-code-error-offending-code condition)))) (:documentation "Communicates an attempt to request a character by adminiculum of an invalid Tanstore code.")) ;;; ------------------------------------------------------- (declaim (type (simple-string 38) +TANSTORE-SYMBOLS+)) ;;; ------------------------------------------------------- (defparameter +TANSTORE-SYMBOLS+ " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " "Maps the recognized characters via their indices into this string to their Tanstore codes.") ;;; ------------------------------------------------------- (defun get-tanstore-code (character) "Returns the Tanstore code affiliated with the CHARACTER, or signals an error of the type ``No-Tanstore-Character-Error`` upon its disrespondency with the Tanstore character repertoire." (declare (type character character)) (the tanstore-code (or (position character +TANSTORE-SYMBOLS+ :test #'char-equal) (error 'No-Tanstore-Character-Error :offending-character character)))) ;;; ------------------------------------------------------- (defun get-tanstore-character (code) "Returns the character amenable to the Tanstore character CODE, or signals an error of the type ``Invalid-Tanstore-Code-Error`` upon its disrespondency with the valid Tanstore character code range." (declare (type tanstore-code code)) (the character (if (array-in-bounds-p +TANSTORE-SYMBOLS+ code) (schar +TANSTORE-SYMBOLS+ code) (error 'Invalid-Tanstore-Code-Error :offending-code code))))