From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: Predicate for true lists Date: Sat, 07 Jul 2018 18:04:28 +0300 Message-ID: <87k1q7ytmr.fsf@tcd.ie> References: <87fu3vdjjk.fsf@tcd.ie> <87bmcqhhsf.fsf@tcd.ie> <87in6xgtpb.fsf@tcd.ie> <2af892df-26cb-60b2-4fd8-067fcb3d32e9@cs.ucla.edu> <87r2kh9uwx.fsf@tcd.ie> <83h8lcnbxb.fsf@gnu.org> <6fc589d1-2c21-3e9b-be47-b7700f61642d@cs.ucla.edu> <831scflefs.fsf@gnu.org> <5d0d79d3-6291-fbf0-1028-064f86787483@cs.ucla.edu> <837em7jrag.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1530975761 22446 195.159.176.226 (7 Jul 2018 15:02:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Jul 2018 15:02:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Paul Eggert , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 07 17:02:36 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fbojM-0005jn-Gw for ged-emacs-devel@m.gmane.org; Sat, 07 Jul 2018 17:02:36 +0200 Original-Received: from localhost ([::1]:33940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbolT-00014M-Jo for ged-emacs-devel@m.gmane.org; Sat, 07 Jul 2018 11:04:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbolN-00014E-55 for emacs-devel@gnu.org; Sat, 07 Jul 2018 11:04:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbolJ-0005UP-Ue for emacs-devel@gnu.org; Sat, 07 Jul 2018 11:04:41 -0400 Original-Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:40035) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fbolJ-0005TV-KL for emacs-devel@gnu.org; Sat, 07 Jul 2018 11:04:37 -0400 Original-Received: by mail-wm0-x236.google.com with SMTP id z13-v6so16832206wma.5 for ; Sat, 07 Jul 2018 08:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=5DTVKL56JxM/AIb7I7YCobwc0egyx6fj8BJ7+YHoquY=; b=VbRDM5tXPC8nBQRnofKzXB7nWKRhUiQe4/BNLRPjjbVyLvO1iG5nOSgjRy9tJ1KX8m EYfCzmkIC7J6odkRMmvdYHuDTX3A67S0AMuCm5HDHIazFEmEmXVghd6o7FrPK0SX4MDN LYt+7/TU9Ab6WZ0KOvzkWW18mYSVCc/knGXBVPUZro6otSwEmATBkq9LVNRoIFc88aRn cVU0AW7o6m4G0DVrm0vZeu3SwirxyQuoEosGYRmhqTb9pqCbQnxZxHYyj71wwAw5Qcuq kK8LkAL9VudXAHK8CAmKMGdl9YwtaUW3uxggd3807Fz/ESr3lljF1GN+NWTTSEq87850 qGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=5DTVKL56JxM/AIb7I7YCobwc0egyx6fj8BJ7+YHoquY=; b=SLXZtqSGi1ZUCWfvIvVii4NhAb2XOcCqelqV5WPJqlhMFStvnBGrlfk3ZsplSJyRyy tUomIuGU55FRSN+1bvPyYmQjd0bbv9nfTUv/mRgG4iiACJmPu+7L4LaSC1rYBoSz4ory sfSiwodutQj6PF78ef4IBmSBz1dak/la1n6zuT2tXornEVSD3/p6bTsNYl1stGC5qOSb 9fI3YvjlDsRTOLeVAEjAzITigLu8gCdLRTrO3I7ftkt5nEFFCxEDdjBSkUeeNPLAXYH/ Kw6MKG5X91mEB1DMn6mVlO3jNKI2Lc5inQuXMgiMxyR9Wsu6UjeJ58HqA+jYQGBdwMVS nFiw== X-Gm-Message-State: APt69E1TwYDo/FbhxaYTZV1i4La0m3DXRUYIzj2VolxfY7zOj/WE6TUm qMZTk+BTO1w5QcfvI6RaAfF5xA== X-Google-Smtp-Source: AAOMgpdQolSXrW7sHFV6G1nOWgHS1zf06zviFHrbN0i4NBkX+ieGsN2tFTdb9IDgUs9hPP49IrVd8Q== X-Received: by 2002:a1c:c40a:: with SMTP id u10-v6mr8247479wmf.10.1530975875986; Sat, 07 Jul 2018 08:04:35 -0700 (PDT) Original-Received: from localhost (adsl-112.91.140.88.tellas.gr. [91.140.88.112]) by smtp.gmail.com with ESMTPSA id r140-v6sm21703313wmd.27.2018.07.07.08.04.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jul 2018 08:04:35 -0700 (PDT) In-Reply-To: <837em7jrag.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 7 Jul 2018 13:04:07 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227063 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Cc: contovob@tcd.ie, emacs-devel@gnu.org >> From: Paul Eggert >> Date: Sat, 7 Jul 2018 01:41:38 -0700 >> >> Eli Zaretskii wrote: >> > the documentation still doesn't say that 'length' signals >> > an error for anything that is not a sequence, which is what >> > proper-list-p is relying on. >> >> The proposed implementation of proper-list-p does not rely on such a signal, > > That's not my reading of the implementation: > > (and (listp object) (ignore-errors (length object))) > ^^^^^^^^^^^^^ The call to 'length' is wrapped in 'ignore-errors' in order to catch the errors signalled in 'Flength' by 'FOR_EACH_TAIL' (in case of circularity) and 'CHECK_LIST_END' (in case of dottedness). 'length' shouldn't signal a 'wrong-type-argument' for a non-sequence argument because it is only called on objects which satisfy 'listp': (and (listp object) (ignore-errors (length object))) ^^^^^^^^^^^^^^ Having said that, would something like the following documentation change be welcome, for completeness? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-length-NON-SEQUENCE-documentation.patch >From 430d858d3617a11a5130a3344a131b5ab976e818 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 7 Jul 2018 17:52:26 +0300 Subject: [PATCH] Fix (length NON-SEQUENCE) documentation For discussion, see thread starting at https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00171.html. * doc/lispref/sequences.texi (Sequence Functions): Mention that 'length' signals a 'wrong-type-argument' also when given a non-sequencep argument. --- doc/lispref/sequences.texi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 59faf2b4f1..e16674db04 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -71,13 +71,14 @@ Sequence Functions @cindex list length @cindex vector length @cindex sequence length +@cindex bool-vector length @cindex char-table length @anchor{Definition of length} This function returns the number of elements in @var{sequence}. If -@var{sequence} is a dotted list, a @code{wrong-type-argument} error is -signaled; if it is a circular list, a @code{circular-list} error is -signaled. For a char-table, the value returned is always one more -than the maximum Emacs character code. +@var{sequence} does not satisfy @code{sequencep} or is a dotted list, +a @code{wrong-type-argument} error is signaled; if it is a circular +list, a @code{circular-list} error is signaled. For a char-table, the value +returned is always one more than the maximum Emacs character code. @xref{Definition of safe-length}, for the related function @code{safe-length}. -- 2.18.0 --=-=-= Content-Type: text/plain -- Basil --=-=-=--