-
Notifications
You must be signed in to change notification settings - Fork 3
/
utilities.lisp
23 lines (20 loc) · 985 Bytes
/
utilities.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(in-package #:cl-skip-list)
(defmacro while (test &rest body)
`(loop until (not ,test) do
,@body))
(defgeneric less-than (x y)
(:documentation "Generic less-than operator. Allows comparison of apples and oranges.")
(:method ((x symbol) (y symbol)) (string< (symbol-name x) (symbol-name y)))
(:method ((x symbol) (y string)) (string< (symbol-name x) y))
(:method ((x symbol) (y number)) (string< (symbol-name x) (write-to-string y)))
(:method ((x number) (y number)) (< x y))
(:method ((x number) (y symbol)) (string< (write-to-string x) (symbol-name y)))
(:method ((x number) (y string)) (string< (write-to-string x) y))
(:method ((x string) (y string)) (string< x y))
(:method ((x string) (y symbol)) (string< x (symbol-name y)))
(:method ((x string) (y number)) (string< x (write-to-string y))))
(defun get-prop (plist prop)
(cond ((null plist) nil)
((eql (car plist) prop)
(cadr plist))
(t (get-prop (cddr plist) prop))))