From 0c2571128963673a6ac7f3af2934985d4b146b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Far=C3=A9=20Rideau?= <fahree@gmail.com> Date: Fri, 9 Oct 2009 22:12:35 +0300 Subject: [PATCH] reorder definitions to get rid of a warning about not inlining a forward reference --- sequences.lisp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sequences.lisp b/sequences.lisp index b1e1533..2c797b9 100644 --- a/sequences.lisp +++ b/sequences.lisp @@ -5,6 +5,26 @@ ;; macro, because inlining seems to cancel compiler macros (at least on SBCL). (declaim (inline copy-sequence sequence-of-length-p)) +(defun sequence-of-length-p (sequence length) + "Return true if SEQUENCE is a sequence of length LENGTH. Signals an error if +SEQUENCE is not a sequence. Returns FALSE for circular lists." + (declare (type array-index length) + (inline length) + (optimize speed)) + (etypecase sequence + (null + (zerop length)) + (cons + (let ((n (1- length))) + (unless (minusp n) + (let ((tail (nthcdr n sequence))) + (and tail + (null (cdr tail))))))) + (vector + (= length (length sequence))) + (sequence + (= length (length sequence))))) + (defun rotate-tail-to-head (sequence n) (declare (type (integer 1) n)) (if (listp sequence) @@ -172,26 +192,6 @@ is a literal integer." length current))))))))))))) -(defun sequence-of-length-p (sequence length) - "Return true if SEQUENCE is a sequence of length LENGTH. Signals an error if -SEQUENCE is not a sequence. Returns FALSE for circular lists." - (declare (type array-index length) - (inline length) - (optimize speed)) - (etypecase sequence - (null - (zerop length)) - (cons - (let ((n (1- length))) - (unless (minusp n) - (let ((tail (nthcdr n sequence))) - (and tail - (null (cdr tail))))))) - (vector - (= length (length sequence))) - (sequence - (= length (length sequence))))) - (defun copy-sequence (type sequence) "Returns a fresh sequence of TYPE, which has the same elements as SEQUENCE." -- GitLab