From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: why are there [v e c t o r s] in Lisp? Date: Sun, 18 Oct 2015 14:32:51 +0200 Message-ID: <87a8rgqrv0.fsf@debian.uxu> References: <87mvvjeg29.fsf@kuiper.lan.informatimago.com> <87eggvebfs.fsf@kuiper.lan.informatimago.com> <87pp0eckss.fsf@kuiper.lan.informatimago.com> <87a8rhcypj.fsf@kuiper.lan.informatimago.com> <87fv19asrn.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1445171056 15442 80.91.229.3 (18 Oct 2015 12:24:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 18 Oct 2015 12:24:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 18 14:24:07 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 1Znn0N-0002z7-G4 for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Oct 2015 14:24:03 +0200 Original-Received: from localhost ([::1]:33564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Znn0N-00036m-0H for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Oct 2015 08:24:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Znn0C-00036d-0h for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 08:23:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Znn08-0005u5-Tg for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 08:23:52 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:42109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Znn08-0005tz-ME for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 08:23:48 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Znn07-0002gf-5x for help-gnu-emacs@gnu.org; Sun, 18 Oct 2015 14:23:47 +0200 Original-Received: from nl106-137-244.student.uu.se ([130.243.137.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 18 Oct 2015 14:23:47 +0200 Original-Received: from embe8573 by nl106-137-244.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 18 Oct 2015 14:23:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-244.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:5k+TEo25+KBWFj1zKYZJirGoqlo= 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:107736 Archived-At: "Pascal J. Bourguignon" writes: > Because the presence of a data type in a language is > unrelated to the presence of a syntax for literal > objects of that type. ... > > So all the combinations are possible, which shows > that having a literal syntax for objects and having > types in a language are two totally > unrelated things. They are two different things but they are not unrelated. If a language offers features A, B, and C, then it should come in with a syntax a, b, and c to facilitate the usage of them features. > Type inference can still be useful in a lisp > compiler, since it allows to produce code that is > a little more efficient: you can avoid generating > type dispatches and type checks in expressions using > a variable, when you can infer that this variable > will always hold values of a certain type. > > For inference, writing > > (let ((a (vector 1 2 3))) (aref a 2)) > > (let ((a [1 2 3])) (aref a 2)) > > have the exact same effect: in both case the > compiler can infer that a is always bound to > a vector of 3 elements, and therefore it can avoid > testing whether 2 is bigger or smaller than the size > of the vector, or that the value bound to a is > indeed a vector before calling aref. Inference can be based on the methods used to interact with the object of the variable. For example the predicates. If there is an `if' form with a predicate test for a string (`stringp') and then an `error' if the variable doesn't hold the string, depending on the context and the sophistication of the inference mechanism, it can be deducted the function should be used with a string as value for a particular argument. But again this is nothing I ever yearned for... -- underground experts united http://user.it.uu.se/~embe8573