Message from discussion
Cookbook question: How to change a list to a vector?
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!p3ee24cc1.dip.t-dialin.NET!not-for-mail
From: wb...@gmx.net (Wolfhard =?iso-8859-1?q?Bu=DF?=)
Newsgroups: comp.lang.lisp
Subject: Re: Cookbook question: How to change a list to a vector?
Date: 15 Feb 2002 10:12:55 +0100
Lines: 19
Message-ID: <m3eljn85wo.fsf@buss-14250.user.cis.dfn.de>
References: <3c6cbb0f.18001906@nntp.interaccess.com>
NNTP-Posting-Host: p3ee24cc1.dip.t-dialin.net (62.226.76.193)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: fu-berlin.de 1013764357 520562 62.226.76.193 (16 [14250])
X-Orig-Path: buss-14250.user.cis.dfn.de!nobody
User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)
olc...@interaccess.com (Thaddeus L Olczyk) writes:
> Given a system that is running slower than you would like.
> One thing that you wish to do is replace a list with a vector
> since you can see many inefficient operations on the list.
> How would one proceed?
(lambda (list) (make-array (length list) :initial-contents list))
comes to mind, or
(lambda (list) (map 'vector #'identity list))
An experienced Lisper might find a more sophisticated operator to
coerce a list into a vector;)
--
"Das Auto hat keine Zukunft. Ich setze aufs Pferd." Wilhelm II. (1859-1941)