From fcb3e7bedb64b98227f0a0966875cd60cb0da8b7 Mon Sep 17 00:00:00 2001 From: dtc <dtc> Date: Wed, 3 Sep 1997 01:00:18 +0000 Subject: [PATCH] The returned vector element type of some sequence functions, including coerce, was being lost. Patch result-type-or-lose to use (type-specifier (specifier-type type)) to find a suitable result type return than just returning 'vector. --- code/seq.lisp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/code/seq.lisp b/code/seq.lisp index a990781f9..7a6cb857d 100644 --- a/code/seq.lisp +++ b/code/seq.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/seq.lisp,v 1.24 1997/08/06 13:42:18 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/seq.lisp,v 1.25 1997/09/03 01:00:18 dtc Exp $") ;;; ;;; ********************************************************************** ;;; @@ -66,16 +66,19 @@ ;;; that we can directly match. ;;; (defun result-type-or-lose (type &optional nil-ok) - (cond - ((subtypep type 'nil) - (if nil-ok - nil - (error "NIL output type invalid for this sequence function."))) - ((dolist (seq-type '(list bit-vector string vector) nil) - (when (subtypep type seq-type) - (return seq-type)))) - (t - (error "~S is a bad type specifier for sequence functions." type)))) + (let ((type (specifier-type type))) + (cond + ((csubtypep type (specifier-type 'nil)) + (if nil-ok + nil + (error "NIL output type invalid for this sequence function."))) + ((dolist (seq-type '(list string simple-vector bit-vector)) + (when (csubtypep type (specifier-type seq-type)) + (return seq-type)))) + ((csubtypep type (specifier-type 'vector)) + (type-specifier type)) + (t + (error "~S is a bad type specifier for sequence functions." type))))) (defun make-sequence-of-type (type length) -- GitLab