From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: Predicate for true lists Date: Fri, 6 Jul 2018 10:16:11 -0700 (PDT) Message-ID: 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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1530897900 30892 195.159.176.226 (6 Jul 2018 17:25:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 6 Jul 2018 17:25:00 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Eli Zaretskii , "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 06 19:24:56 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 1fbUTX-0007wP-Se for ged-emacs-devel@m.gmane.org; Fri, 06 Jul 2018 19:24:56 +0200 Original-Received: from localhost ([::1]:59076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbUVf-0001Tf-62 for ged-emacs-devel@m.gmane.org; Fri, 06 Jul 2018 13:27:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbULH-0002BE-TO for emacs-devel@gnu.org; Fri, 06 Jul 2018 13:16:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbULH-0001aU-0d for emacs-devel@gnu.org; Fri, 06 Jul 2018 13:16:23 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:48906) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fbULB-0001W8-8Q; Fri, 06 Jul 2018 13:16:17 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w66HDdGV155422; Fri, 6 Jul 2018 17:16:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=o+UbcEqzwWURvCg3Qz2YubMNjrhyGBpjc1TSbs/0Lbg=; b=MuBW2Q0mPmyBlOu+nnUWNcvW2YMHWDyK5g6bysu1pB1WU1ZN+d+F0CP4bRyjBgFu9Ov2 Ja+DP728kse5NhgtxEbRjfvFwJHye8fZuKYJna5RMQcivgsqp/mUTZ7UH/OCVjZ3uLCZ sc2oQTE1E08YBB7UqpGFXzLKRZk6mVhczq4i1Sg17Mq0lQeWDMZYqofCsH9Ls6zUjKjB fdzsihfOmM0yINPEdPCrtIzQGFiD+USuWLLWkfAeMrTKRTHuEKj2y4EFQeNuQeWdcfq0 90RR+mmC6tsiH64bHR9qlA5DmVHJuQRxmJg9JnnxLfSOvb2UchZCzY6uDozQ6uckskBF zA== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2k0dnjthff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Jul 2018 17:16:14 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w66HGDLx021977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Jul 2018 17:16:14 GMT Original-Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w66HGDmm022829; Fri, 6 Jul 2018 17:16:13 GMT In-Reply-To: <83h8lcnbxb.fsf@gnu.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4705.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8945 signatures=668704 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=686 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807060191 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 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:227011 Archived-At: > > +** New function 'proper-list-length'. > > +Given a proper list as argument, this function returns its length; > > +otherwise, it returns nil. This function can thus be used as a > > +predicate for proper lists. >=20 > Do we really want this usage of the function as a predicate? I find > this slightly unnatural, and also not future-proof enough, because you > rely on the checks 'length' does internally. If the internals of > 'length' change one day, this predicate usage will collapse like a > house of cards. Would it make more sense to have a separate > predicate? IIRC, the main motivation for adding this function was to provide a predicate for testing properness. I see no reason why we should have two functions that do essentially the same thing: the proposed function to obtain the length plus a function such as this: (defun proper-list-p (object) "Return non-nil if OBJECT is a proper list." (and (proper-list-length object) t)) We should just have one function, and make clear its use as a predicate. If we really want to make that clear and discoverable then provide `proper-list-p' as an alias for `proper-list-length'. That makes both uses clear without having two functions. [The name `proper-list-length' can make it sound like it returns the proper length of a list, not the length of a proper list. But I can't think of a better name. (And `list-proper-length' is what we would really call a function that did provide the "proper length" of a list.)]