-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtestchar.tel
More file actions
24 lines (21 loc) · 1.08 KB
/
testchar.tel
File metadata and controls
24 lines (21 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
isEven = \n -> { \i -> left i
, \recur i -> recur (left (left i), not (right i))
, \i -> right i
} (n, 1)
validAscii = \x -> assert (not ($127 left x)) "invalid character"
main = \input -> let userInput = left input
firstChar = left userInput
-- limInput = min 128 firstChar
limInput : validAscii = firstChar
oldState = right input
output = concat ["ascii value of first char is "
, if isEven limInput then "even" else "odd"
-- , " --"
-- , (limInput, 0)
-- , "--"
-- , if left limInput then "there's something there" else "oh no, nothing!"
]
-- output = if isEven limInput then "A" else "B"
in if not input
then ("enter a character", 1)
else (output, 0)