forked from joelvaneenwyk/language84
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.84
More file actions
49 lines (36 loc) · 668 Bytes
/
string.84
File metadata and controls
49 lines (36 loc) · 668 Bytes
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
{
: append
: concat
: join
: equal
: length
: fetch
: clip
: compare
}
Where
Define (join glue strings)
(concat (LIST.join glue strings))
Where
Define (concat strings) (LIST.reduce strings "" append)
Where
Define (compare a b)
Let sign (Prim string_compare a b)
In
Cond {
| [sign = -1] 'less
| [sign = 0] 'equal
| [sign = 1] 'greater
}
Define (append s1 s2)
(Prim string_append s1 s2)
Define (equal s1 s2)
(Prim string_equal s1 s2)
Define (length s)
(Prim string_length s)
Define (fetch s i)
(Prim string_fetch s i)
Define (clip s begin end)
(Prim string_clip s begin end)
Where
Let LIST Package "list"