From ce8aa912f6643b102b81eb37a0cb9d37f0661925 Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Mon, 12 Feb 2007 22:01:19 +0100 Subject: [PATCH] sequence cleanup --- lsbasics.lsp | 29 ----------------------------- sequence.lsp | 6 ++++++ 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/lsbasics.lsp b/lsbasics.lsp index dc47281..6961eec 100644 --- a/lsbasics.lsp +++ b/lsbasics.lsp @@ -213,35 +213,6 @@ Returns a copy of the array A" ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; sequence predicate SEQUENCEP -;;; - -(defun sequencep (x) -"Args: (x) -Returns NIL unless X is a list or vector." - (or (listp x) (vectorp x))) - -;;; -;;; ISEQ - generate a sequence of consecutive integers from a to b -;;; - -(defun iseq (a &optional b) -"Args: (n &optional m) -With one argumant returns a list of consecutive integers from 0 to N - 1. -With two returns a list of consecutive integers from N to M. -Examples: (iseq 4) returns (0 1 2 3) - (iseq 3 7) returns (3 4 5 6 7) - (iseq 3 -3) returns (3 2 1 0 -1 -2 -3)" - (if b - (let ((n (+ 1 (abs (- b a)))) - (x nil)) - (dotimes (i n x) - (setq x (cons (if (< a b) (- b i) (+ b i)) x)))) - (cond - ((= 0 a) nil) - ((< a 0) (iseq (+ a 1) 0)) - ((< 0 a) (iseq 0 (- a 1)))))) ;;;; ;;;; WHICH function diff --git a/sequence.lsp b/sequence.lsp index 6f2b1cd..fcd9a1e 100644 --- a/sequence.lsp +++ b/sequence.lsp @@ -18,11 +18,17 @@ (in-package #:lisp-stat-sequence) +;;; Sequences are part of ANSI CL, being a supertype of vector and +;;; list (ordered set of things). + ;;; Type Checking Functions (defun check-sequence (a) (if (not (or (vectorp a) (consp a))) (error "not a sequence - ~s" a))) + + + ;;; Sequence Element Access (defun get-next-element (x i) -- 2.11.4.GIT