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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*!
# Functions
*/

pub mod ABS {
    /*!
    ## `ABS(X)` Returns the absolute value of X.
    ```text
    PRINT ABS(-0.123)
     0.123
    ```
    */
}

pub mod ASC {
    /*!
    ## `ASC(X$)` Returns the unicode value of the first character of X.
    ```text
    PRINT ASC("A")
     65
    ```
    */
}

pub mod CHR {
    /*!
    ## `CHR$(X)` Returns a character of ASCII X.
    ```text
    PRINT CHR$(65)
    A
    ```
    */
}

pub mod COS {
    /*!
    ## `COS(X)` Returns the cosine of X in radians.
    ```text
    PRINT COS(0.123)
     0.99244505
    ```
    */
}

pub mod EXP {
    /*!
    ## `EXP(X)` Returns e to the power of X.
    ```text
    PRINT EXP(1)
     2.7182817
    ```
    */
}

pub mod INT {
    /*!
    ## `INT(X)` Returns the largest integer <= X.
    ```text
    PRINT INT(9.9) INT(-9.9)
     9 -10
    ```
    */
}

pub mod LEFT {
    /*!
    ## `LEFT$(A$,X)` Returns the leftmost X characters of A$.
    ```text
    PRINT LEFT$("HUNT THE WUMPUS", 4)
    HUNT
    ```
    */
}

pub mod LEN {
    /*!
    ## `LEN(X$)` Returns the number of characters in X$.
    ```text
    PRINT LEN("TO")
     2
    ```
    */
}

pub mod MID {
    /*!
    ## `MID$(A$,X,[Y])` Returns a portion of A$.
    The returned string will begin with the character in position X.
    If Y is present it will limit the length, otherwise everything
    until the end of the string is returned.
    ```text
    PRINT MID$("HUNT THE WUMPUS", 6, 3)
    THE
    PRINT MID$("HUNT THE WUMPUS", 6)
    THE WUMPUS
    ```
    */
}

pub mod RIGHT {
    /*!
    ## `RIGHT$(A$,X)` Returns the rightmost X characters of A$.
    ```text
    PRINT RIGHT$("HUNT THE WUMPUS", 6)
    WUMPUS
    ```
    */
}

pub mod RND {
    /*!
    ## `RND(X)` Returns a pseudo-random number.
    Wichman-Hill Random Number Generator.
    Returns a random Single between 0 and 1 when X is missing or > 0.
    When X is 0, return the previous random number.
    When X < 0 the random number generator is seeded with X.
    ```text
    PRINT RND()
     0.6923401
    ```
    */
}

pub mod SGN {
    /*!
    ## `SGN(X)` Returns the sign of X.
    Returns -1 if X is negative, 1 if positive, and 0 if zero.
    ```text
    PRINT SGN(+1)
     1
    ```
    */
}

pub mod SIN {
    /*!
    ## `SIN(X)` Returns the sine of X in radians.
    ```text
    PRINT SIN(0.123)
     0.1226901
    ```
    */
}

pub mod SQR {
    /*!
    ## `SIN(X)` Returns the square root of X.
    ```text
    PRINT SQR(5)
     2.236068
    ```
    */
}

pub mod STR {
    /*!
    ## `STR$(X)` Returns the number X as a string.
    ```text
    PRINT STR$(-3.14) + "!"
     -3.14!
    ```
    */
}

pub mod TAB {
    /*!
    ## `TAB(X)` Returns a string of spaces.
    Used in a `PRINT` statement, moves to the requested column.
    Does nothing if already past the requested column.
    If X is negative, moves to the start of next -X wide zone.
    ```text
    PRINT 1.99 TAB(20) "furlongs per year"
     1.99               furlongs per year
    ```
    */
}

pub mod VAL {
    /*!
    ## `VAL(X$)` Returns a number parsed from string X$.
    ```text
    PRINT VAL("1E-2")
     0.01
    ```
    */
}