-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstring.lisp
More file actions
40 lines (34 loc) · 944 Bytes
/
Copy pathstring.lisp
File metadata and controls
40 lines (34 loc) · 944 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
(defun showLen (x)
(println "The length of : '" x "' is " (strlen x)))
(defun showCmp( a b )
(println
"comparing a:" a
" with b:" b
" (strcmp a b): " (strcmp a b)
" (= a b): " (= a b)))
(defun main (args)
"Test strlen/strcmp"
; strlen test
(showLen "Steve")
(showLen "")
; strcmp test
(showCmp "Steve" "Steve")
(showCmp "Steve" "Rteve")
; These should be identical even though the addresses will be different
(showCmp "Hello" (implode (explode "Hello")))
(showCmp "Hello" (strdup "Hello"))
(showCmp "Hello" (strcat (strdup "Hell") (strdup "o")))
; string conversion
(print (string "Hello!\n"))
(print (string #\h))
(print (string #\e))
(print (string #\l))
(print (string #\l))
(print (string #\o))
(print (string #\\n))
(println (string 32))
(println (string -16386))
(println (string (- 0 (/ 1.0 3.0))))
(println (string 2.5))
(println (string -1.75))
)