LSCEF
Jump to navigation
Jump to search
LSCEF (Lebster's Standard Character Encoding Format) is a method of storing character data created by User:Lebster. Its purpose was to provide an alternative to ASCII for EsoLang creators.
Encoding
LSCEF | Character |
---|---|
0 | NEW LINE |
1 | SPACE |
2 | A |
3 | B |
4 | C |
5 | D |
6 | E |
7 | F |
8 | G |
9 | H |
10 | I |
11 | J |
12 | K |
13 | L |
14 | M |
15 | N |
16 | O |
17 | P |
18 | Q |
19 | R |
20 | S |
21 | T |
22 | U |
23 | V |
24 | W |
25 | X |
26 | Y |
27 | Z |
28 | a |
29 | b |
30 | c |
31 | d |
32 | e |
33 | f |
34 | g |
35 | h |
36 | i |
37 | j |
38 | k |
39 | l |
40 | m |
41 | n |
42 | o |
43 | p |
44 | q |
45 | r |
46 | s |
47 | t |
48 | u |
49 | v |
50 | w |
51 | x |
52 | y |
53 | z |
54 | 0 |
55 | 1 |
56 | 2 |
57 | 3 |
58 | 4 |
59 | 5 |
60 | 6 |
61 | 7 |
62 | 8 |
63 | 9 |
64 | ! |
65 | " |
66 | £ |
67 | $ |
68 | % |
69 | ^ |
70 | & |
71 | * |
72 | ( |
73 | ) |
74 | { |
75 | } |
76 | [ |
77 | ] |
78 | - |
79 | = |
80 | _ |
81 | + |
82 | ; |
83 | ' |
84 | # |
85 | ~ |
86 | @ |
87 | : |
88 | , |
89 | . |
90 | / |
91 | ? |
92 | > |
93 | < |
94 | \ |
95 | | |
96 | ` |
97 | TAB (\t) |
Usage in interpreters
Javascript:
const toLSCEF=(c=>"\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t".indexOf(c)) const fromLSCEF=(c=>"\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t"[c]) toLSCEF("<") // Returns 93 fromLSCEF(93) // Returns "<"
toLSCEF=lambda c:"\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t".find(c) fromLSCEF=lambda c:"\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t"[c] toLSCEF("A") # Returns 2 fromLSCEF(2) # Returns 'A'
SWI-Prolog:
lscef(C, N) :- nth0(N, Chars, C), string_chars("\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t", Chars). Query: lscef(X, 12). lscef('\t', Y). % results in X = 'K', Y = 97
Chez Scheme:
(define (toLSCEF n) (string-ref "\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t" n)) (define (index v l) (cdr (assq v (map cons l (enumerate l))))) (define (fromLSCEF c) (index c (string->list "\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t"))) (pretty-print (toLSCEF 0)) ; Returns \#newline (pretty-print (fromLSCEF #\h)) ; Returns 35
Wikipedia:C (programming language):
#define LSCEF_STR "\n ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*(){}[]-=_+;'#~@:,./?><\\|`\t" #define LSCEF_STR_LEN 98 int toLSCEF(char c); char fromLSCEF(int n); int toLSCEF(char c) { int i; for(i = 0; i < LSCEF_STR_LEN; ++i) if(c == LSCEF_STR[i]) return i; return -1; } char fromLSCEF(int n) { if(n < LSCEF_STR_LEN) return LSCEF_STR[n]; else return (char)-1; }
If you are able to write functions for other languages please add them here!