-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlist.lisp
More file actions
63 lines (50 loc) · 1.31 KB
/
Copy pathlist.lisp
File metadata and controls
63 lines (50 loc) · 1.31 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
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
(defvar by-five (lambda (x) (* x 5)))
(defun main (args)
(let ((lst (list 3 4 5 (list 5 2 1) (list 3 12 99))))
(print "Original list: ")
(print lst)
(newline)
(print "Flatted list: ")
(print (flatten lst))
(newline)
(print "Minimum entry in list: ")
(print (min (flatten lst)))
(newline)
(print "Maximum entry in list: ")
(print (max (flatten lst)))
(newline)
)
(let ((ones (repeated 10 1))
(me (repeated 10 "me")))
(print "Repeated ones: ")
(println ones)
(print "Repeated me: ")
(println me)
)
(repeat 5 (lambda (n) (println "I was called by repeat: " n)))
(println (join (list "This"
" is "
"a"
" test "
"of joining"
" strings!")))
; Add a separator is nice.
(println (join-by (list "1" "2" "3" "4" "5" "6") ","))
(let ((n (list 10 20 30 40 50)))
(print "List : ")
(println n)
(print "0 :")
(println (nth n 0))
(print "1 :")
(println (nth n 1))
(print "2 :")
(println (nth n 2))
(nth! n 0 "Steve")
(nth! n 1 "says")
(nth! n 2 "hello")
(print "List updated : ")
(println n))
; Lambda in global variable
(let ((x (list 1 2 3 4 5)))
(println (map by-five x)))
)