From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Random832 Newsgroups: gmane.emacs.help Subject: Re: why are there [v e c t o r s] in Lisp? Date: Thu, 15 Oct 2015 22:56:27 -0400 Message-ID: <87io67zfl0.fsf@fastmail.com> References: <87mvvjeg29.fsf@kuiper.lan.informatimago.com> <87io67pmr7.fsf@debian.uxu> <87mvvjzgup.fsf@fastmail.com> <87d1wfplu5.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1444964247 17699 80.91.229.3 (16 Oct 2015 02:57:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Oct 2015 02:57:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 16 04:57:18 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZmvCm-0006G6-V2 for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Oct 2015 04:57:17 +0200 Original-Received: from localhost ([::1]:50585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmvCl-0001iz-T5 for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Oct 2015 22:57:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmvCb-0001is-U3 for help-gnu-emacs@gnu.org; Thu, 15 Oct 2015 22:57:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmvCY-0000V3-IO for help-gnu-emacs@gnu.org; Thu, 15 Oct 2015 22:57:05 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:51285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmvCY-0000TS-9c for help-gnu-emacs@gnu.org; Thu, 15 Oct 2015 22:57:02 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZmvCW-0005ys-2a for help-gnu-emacs@gnu.org; Fri, 16 Oct 2015 04:57:00 +0200 Original-Received: from c-68-39-146-59.hsd1.in.comcast.net ([68.39.146.59]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 16 Oct 2015 04:57:00 +0200 Original-Received: from random832 by c-68-39-146-59.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 16 Oct 2015 04:57:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 30 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-68-39-146-59.hsd1.in.comcast.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:8Gp9/9Xp0TqoX2TcnMSW0tb5VQ4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107669 Archived-At: Emanuel Berg writes: > If a list just contains say a bunch of known integers > that don't need to be computed, is there anything that > stops this list from being stored in "contiguous > memory" with the list functions as well as the > constant access time "vector" functions available? Well, what happens if you cdr that list? Does it make a copy? Wasted memory, wasted time, won't track if you change the original. Yeah, yeah, in platonic ideal lisp you *can't* change lists, but this is the real world, where even scheme lets you do it. Does it keep a reference to the original list? Then what if you take the cd^{4000}r of a list of 5000, then throw away the original? Wasted memory again. Java used to have this issue with strings. I suppose you could have the underlying array somehow know what the earliest index that a reference actually exists for is, and magically throw away everything before it during garbage collection, if there's too much wasted space. But that seems rather a lot of work. > By the way: in my previous post strings were mentioned > and it sounded like they were sugar for lists of chars > - this isn't the case (you can't `car' a string) but > it could have been and it isn't harmful (I think) to > think of strings that way. The thing is, if you can car a string people will wonder why you can't cdr it. And with mutable objects it's hard to make cdr work right. (fsvo "right")