1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
use crate::{
    alphanumeric::prelude::*,
    core::prelude::*,
};

impl ArrayElement for char {

    fn zero() -> Self {
        '0'
    }

    fn one() -> Self {
        '1'
    }

    fn is_nan(&self) -> bool {
        false
    }
}

impl Alphanumeric for char {

    fn from_str(str: &str) -> Self {
        str.chars().next().unwrap_or('0')
    }

    fn _append(&self, _: Self) -> Self {
        *self
    }

    fn _multiply(&self, _: usize) -> Self {
        *self
    }

    fn _capitalize(&self) -> Self {
        self.to_string()._capitalize().chars().next().unwrap_or('0')
    }

    fn _lower(&self) -> Self {
        self.to_string()._lower().chars().next().unwrap_or('0')
    }

    fn _upper(&self) -> Self {
        self.to_string()._upper().chars().next().unwrap_or('0')
    }

    fn _swapcase(&self) -> Self {
        self.to_string()._swapcase().chars().next().unwrap_or('0')
    }

    fn _center(&self, _: usize, _: char) -> Self {
        *self
    }

    fn _join(&self, _: Self) -> Self {
        *self
    }

    fn _partition(&self, sep: Self) -> Tuple3<Self, Self, Self> {
        Tuple3(*self, sep, ' ')
    }

    fn _rpartition(&self, sep: Self) -> Tuple3<Self, Self, Self> {
        Tuple3(*self, sep, ' ')
    }

    fn _split(&self, sep: Self, _: Option<usize>) -> List<Self> {
        List(vec![*self, sep, ' '])
    }

    fn _rsplit(&self, sep: Self, _: Option<usize>) -> List<Self> {
        List(vec![' ', sep, *self])
    }

    fn _splitlines(&self, _: bool) -> List<Self> {
        List(vec![*self])
    }

    fn _replace(&self, old: Self, new: Self, _: Option<usize>) -> Self {
        if *self == old { new }
        else { old }
    }

    fn _strip(&self, chars: Self) -> Self {
        if *self == chars { ' ' }
        else { *self }
    }

    fn _ljust(&self, _: usize, _: char) -> Self {
        *self
    }

    fn _lstrip(&self, chars: Self) -> Self {
        if *self == chars { ' ' }
        else { *self }
    }

    fn _rjust(&self, _: usize, _: char) -> Self {
        *self
    }

    fn _rstrip(&self, chars: Self) -> Self {
        if *self == chars { ' ' }
        else { *self }
    }

    fn _equal(&self, other: Self) -> bool {
        *self == other
    }

    fn _not_equal(&self, other: Self) -> bool {
        !self._equal(other)
    }

    fn _greater_equal(&self, other: Self) -> bool {
        *self >= other
    }

    fn _less_equal(&self, other: Self) -> bool {
        *self <= other
    }

    fn _greater(&self, other: Self) -> bool {
        *self > other
    }

    fn _less(&self, other: Self) -> bool {
        *self < other
    }

    fn _count(&self, sub: &str) -> usize {
        if *self == sub.chars().next().unwrap_or(' ') { 1 } else { 0 }
    }
}