From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: why are there [v e c t o r s] in Lisp? Date: Sun, 18 Oct 2015 22:17:30 +0100 Message-ID: <87r3kr27x1.fsf@robertthorpeconsulting.com> References: <87eggs6ykj.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1445203080 31199 80.91.229.3 (18 Oct 2015 21:18:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 18 Oct 2015 21:18:00 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 18 23:17:51 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 1ZnvKw-0002bj-D4 for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Oct 2015 23:17:50 +0200 Original-Received: from localhost ([::1]:35566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnvKv-0004DL-Ms for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Oct 2015 17:17:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnvKk-0004DD-Jn for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 17:17:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZnvKh-00057f-6o for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 17:17:38 -0400 Original-Received: from outbound-smtp02.blacknight.com ([81.17.249.8]:52570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnvKg-000568-Uu for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 17:17:35 -0400 Original-Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id 9FC7698D0B for ; Sun, 18 Oct 2015 21:17:31 +0000 (UTC) Original-Received: (qmail 25456 invoked from network); 18 Oct 2015 21:17:31 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[109.79.54.219]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 18 Oct 2015 21:17:31 -0000 In-Reply-To: <87eggs6ykj.fsf@debian.uxu> (message from Emanuel Berg on Sun, 18 Oct 2015 16:28:12 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.8 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:107743 Archived-At: Emanuel Berg writes: > Now that I know it isn't so I don't think the > syntax is bad. Actually, I'm curious about CL and > using the industrial Lisps to do "real" programs, > where types, data structures, memory usage, come to > play once again. There's one thing that Pascal didn't mention directly.... In some cases having literal syntax in Lisp is more important than in other languages. In Lisp we have the function "read" which can read in anything that has a read syntax. Let's say you have a program that has an data file format. That file can be stored using "print" and read-back using "read". For example, configuration could be stored as a list. That list could contain other lists, strings and vectors. Read and print eliminate the need to write a parser. As a side-effect they may make the file human readable. That makes having a vector or array syntax more useful. Let's say the program is a CAD package and it's storing a 3D model. That would use a lot of arrays. If Lisp had no literal array syntax then lists would have to be used, then converted to arrays later. That could be very inefficient for large models. Another issue is code generators. Often they produce tables that are best stored in arrays. Take parser generators for example. Let's say a lisp dialect has the syntax (v '(1 2 3)). The function "v" means turn the following list into an array. For human usage that would be fine, the delay in translating lists to arrays would be small. But, for generated code it could be a problem. Last time I looked, the parser generators for C++ used C arrays because C++ lacks literal array syntax for C++ arrays. BR, Robert Thorpe