blob: c900731584fc186b029eef66b20f648901799faa (
plain)
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
|
(in-package #:queue)
(declaim (optimize (speed 3) (safety 1)))
(defun new ()
(cons nil nil))
(defun add (q datum)
(let ((element (cons datum nil)))
(if (car q)
(setf (cddr q) element)
(setf (car q) element))
(setf (cdr q) element)
q))
(defun sub (q)
(pop (car q)))
(defun peek (q)
(caar q))
(defun to-list (q)
(car q))
(defun from-list (lst)
(cons lst (last lst)))
|