-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-functions.lisp
executable file
·63 lines (60 loc) · 1.45 KB
/
run-functions.lisp
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
(setq selection (string-downcase (car *args*)))
; selection is the string "nil" if there is no argument.
(setq run-all (or (string= selection "nil") (string= selection "a")))
; a: all functions
; f: fibonacci
; g: greatest common divisor
; l: leap-year
(when (or run-all (string= selection "g")) (progn
(load "euclid.lisp")
(print-gcd 72 48)
(print-gcd 23 19)
(print-gcd 144 60)
(print-gcd 256 64)
(terpri)
)
)
(when (or run-all (string= selection "f")) (progn
(load "fibonacci.lisp")
(print-fibonacci 0)
(print-fibonacci 1)
(print-fibonacci 2)
(print-fibonacci 3)
(print-fibonacci 4)
(print-fibonacci 5)
(print-fibonacci 6)
(print-fibonacci 7)
(print-fibonacci 8)
(print-fibonacci 9)
(print-fibonacci 10)
(print-fibonacci 11)
(print-fibonacci 12)
(terpri)
)
)
(when (or run-all (string= selection "l")) (progn
(load "leap-year.lisp")
(print-is-leap-year 2024)
(print-is-leap-year 2023)
(print-is-leap-year 2004)
(print-is-leap-year 2000)
(print-is-leap-year 1996)
(print-is-leap-year 1900)
(print-is-leap-year 842)
(print-is-leap-year 840)
(print-is-leap-year 4)
(print-is-leap-year 1)
(print-is-leap-year 0)
(print-is-leap-year -1)
(print-is-leap-year -4)
(print-is-leap-year -840)
(print-is-leap-year -842)
(print-is-leap-year -1900)
(print-is-leap-year -1996)
(print-is-leap-year -2000)
(print-is-leap-year -2004)
(print-is-leap-year -2023)
(print-is-leap-year -2024)
(terpri)
)
)