-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.lisp
More file actions
36 lines (28 loc) · 899 Bytes
/
test.lisp
File metadata and controls
36 lines (28 loc) · 899 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
(defun hello-world()
"This says hello world"
(format t "hello, world"))
(defun foo(a b &optional (c 10 c-p) &rest values)
(list a b c c-p values))
; (dolist (value values)
; (format t "value : ~a" value)))
(defun foorest(&rest values)
(dolist (value values)
(format t "value : ~a" value)))
(defun plot (fn min max step)
(loop for i from min to max by step do
(loop repeat (funcall fn i) do (format t "*"))
(format t "~%")))
(defun primep(number)
(when (> number 1)
(loop for fac from 2 to (isqrt number) never (zerop (mod number fac)))))
(defun next-prime(number)
(loop for n from number when (primep n) return n))
(defun list-primes(end-range)
(do ((p (next-prime 0) (next-prime (1+ p))))
((> p 19))
(format t "~d " p)))
(defun do-test()
(do ((n 0 (1+ n))
(cur 0 next)
(next 1 (+ cur next)))
((= 10 n) cur)))