X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=seqs.lisp;h=8ef74673c0c54c4d67fd14f57c2952675e1f0e70;hb=12026eac09e773e83887a6073d5a034979ce7043;hp=b86d5ec177f215a0a92d018831019671ec4b03e4;hpb=298d0534004c26eb5a6881ea34658f59e180b63b;p=kmrcl.git diff --git a/seqs.lisp b/seqs.lisp index b86d5ec..8ef7467 100644 --- a/seqs.lisp +++ b/seqs.lisp @@ -7,8 +7,6 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: seqs.lisp,v 1.2 2003/05/04 14:52:10 kevin Exp $ -;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; ;;;; KMRCL users are granted the rights to distribute and use this software @@ -16,54 +14,13 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package :kmrcl) - - -(defun mapappend (func seq) - (apply #'append (mapcar func seq))) - -(defun mapcar-append-string-nontailrec (func v) - "Concatenate results of mapcar lambda calls" - (aif (car v) - (concatenate 'string (funcall func it) - (mapcar-append-string-nontailrec func (cdr v))) - "")) - - -(defun mapcar-append-string (func v &optional (accum "")) - "Concatenate results of mapcar lambda calls" - (aif (car v) - (mapcar-append-string - func - (cdr v) - (concatenate 'string accum (funcall func it))) - accum)) - -(defun mapcar2-append-string-nontailrec (func la lb) - "Concatenate results of mapcar lambda call's over two lists" - (let ((a (car la)) - (b (car lb))) - (if (and a b) - (concatenate 'string (funcall func a b) - (mapcar2-append-string-nontailrec func (cdr la) (cdr lb))) - ""))) - -(defun mapcar2-append-string (func la lb &optional (accum "")) - "Concatenate results of mapcar lambda call's over two lists" - (let ((a (car la)) - (b (car lb))) - (if (and a b) - (mapcar2-append-string - func - (cdr la) - (cdr lb) - (concatenate 'string accum (funcall func a b))) - accum))) +(in-package #:kmrcl) -(defun nsubseq (sequence start &optional (end (length sequence))) +(defun nsubseq (sequence start &optional end) "Return a subsequence by pointing to location in original sequence" + (unless end (setq end (length sequence))) (make-array (- end start) - :element-type (array-element-type sequence) - :displaced-to sequence - :displaced-index-offset start)) + :element-type (array-element-type sequence) + :displaced-to sequence + :displaced-index-offset start))