Move more code to sequence.lisp
authorDavid Vázquez <davazp@gmail.com>
Mon, 6 May 2013 13:14:18 +0000 (14:14 +0100)
committerDavid Vázquez <davazp@gmail.com>
Mon, 6 May 2013 13:14:18 +0000 (14:14 +0100)
src/boot.lisp
src/sequence.lisp

index 9e9b027..72c43cb 100644 (file)
   (and (<= 0 weight 9)
        (char "0123456789" weight)))
 
-(defun subseq (seq a &optional b)
-  (if b
-      (slice seq a b)
-      (slice seq a)))
-
-(defmacro do-sequence (iteration &body body)
-  (let ((seq (gensym))
-        (index (gensym)))
-    `(let ((,seq ,(second iteration)))
-       (cond
-         ;; Strings
-         ((stringp ,seq)
-          (let ((,index 0))
-            (dotimes (,index (length ,seq))
-              (let ((,(first iteration)
-                     (char ,seq ,index)))
-                ,@body))))
-         ;; Lists
-         ((listp ,seq)
-          (dolist (,(first iteration) ,seq)
-            ,@body))
-         (t
-          (error "type-error!"))))))
-
 (defun equal (x y)
   (cond
     ((eql x y) t)
index e5e7aca..42e7795 100644 (file)
 ;; You should have received a copy of the GNU General Public License
 ;; along with JSCL.  If not, see <http://www.gnu.org/licenses/>.
 
+(defmacro do-sequence (iteration &body body)
+  (let ((seq (gensym))
+        (index (gensym)))
+    `(let ((,seq ,(second iteration)))
+       (cond
+         ;; Strings
+         ((stringp ,seq)
+          (let ((,index 0))
+            (dotimes (,index (length ,seq))
+              (let ((,(first iteration)
+                     (char ,seq ,index)))
+                ,@body))))
+         ;; Lists
+         ((listp ,seq)
+          (dolist (,(first iteration) ,seq)
+            ,@body))
+         (t
+          (error "type-error!"))))))
+
 (defmacro doseq ((elt seq &optional index) &body body)
   (let* ((nseq (gensym "seq"))
          (i (or index (gensym "i")))
      (cons (car list) (remove-if-not func (cdr list))))
     (t
      (remove-if-not func (cdr list)))))
+
+(defun subseq (seq a &optional b)
+  (if b
+      (slice seq a b)
+      (slice seq a)))
+