From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: why are there [v e c t o r s] in Lisp? Date: Sat, 17 Oct 2015 17:16:24 +0200 Organization: Informatimago Message-ID: <87a8rhcypj.fsf@kuiper.lan.informatimago.com> References: <87mvvjeg29.fsf@kuiper.lan.informatimago.com> <87eggvebfs.fsf@kuiper.lan.informatimago.com> <87pp0eckss.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1445095230 12894 80.91.229.3 (17 Oct 2015 15:20:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 17 Oct 2015 15:20:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 17 17:20:26 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 1ZnTHU-0005Hw-I9 for geh-help-gnu-emacs@m.gmane.org; Sat, 17 Oct 2015 17:20:24 +0200 Original-Received: from localhost ([::1]:58636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnTHU-0001oi-32 for geh-help-gnu-emacs@m.gmane.org; Sat, 17 Oct 2015 11:20:24 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 68 Original-X-Trace: individual.net 2gv1TCKWZGNFToeVJvp92AzuFufy78ujOMooK/GCDqCBnsBJvd Cancel-Lock: sha1:MjI1ZTQ2ZGUzZjRhZThiNzIwZjFhY2Q3ZjlmMzIzN2Q3ZjU2MDhmMw== sha1:YPqX6r0v3GEI3tkVOzeZPo0dxb8= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:215423 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:107708 Archived-At: Emanuel Berg writes: > "Pascal J. Bourguignon" > writes: > >>> Why the syntax is there at all is to provide fast >>> (faster) access to the vector data type which has >>> other time and space properties than do lists. >> >> ABSOLUTELY NOT. >> >> For example, in C++ you have vectors and lists, but >> you don't have any literal syntax for them. >> >> You can have fast and slow data structures without >> having any literal syntax for it. >> >> Why do you keep confusing the two concepts? > > The original question was why there is a special > syntax for vectors, even as lists are perfectly fitted > to be vectors. You did it again. You are asking why apples are of a certain color, even as peaches have a kernel. The two things are totally unrelated. > The question was not why there are lists AND vectors. If the question excludes this, then then original question is "why there is a special syntax for vectors?". And I gave you the answer: because otherwise you would have to build vectors are run-time using a more complex expression and a more complex algorithm. Also, the compiler couldn't perform the optimization it is allowed to perform on literal objects, namely coalescing of equal literals, and storing them in ROM. > But that issue is also interesting so that discussion > wasn't wasted on anyone who read it (perhaps). > > As for the syntax, the "literal" > > [1 2 3] > > is a faster and more readable way than > > (vector 1 2 3) > > to tell the computer when it should use what, because > the computer isn't advanced enough to figure this out > on it own. I don't know what you mean by "this" in "figure this out on its own". The speed is irrelevant here, there are semantic differences: (setf print-circle t) (loop repeat 3 collect [1 2 3]) --> (#1=[1 2 3] #1# #1#) (loop repeat 3 collect (vector 1 2 3)) --> ([1 2 3] [1 2 3] [1 2 3]) -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk