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: Tue, 05 Jun 2018 16:05:04 +0100 Message-ID: <87in6xgtpb.fsf@tcd.ie> References: <87fu3vdjjk.fsf@tcd.ie> <87bmcqhhsf.fsf@tcd.ie> 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 1528210998 19203 195.159.176.226 (5 Jun 2018 15:03:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 5 Jun 2018 15:03:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 05 17:03:14 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 1fQDUP-0004ss-Pa for ged-emacs-devel@m.gmane.org; Tue, 05 Jun 2018 17:03:14 +0200 Original-Received: from localhost ([::1]:47390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQDWV-00028u-Ch for ged-emacs-devel@m.gmane.org; Tue, 05 Jun 2018 11:05:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQDWM-0001x3-1K for emacs-devel@gnu.org; Tue, 05 Jun 2018 11:05:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQDWG-00038L-Dj for emacs-devel@gnu.org; Tue, 05 Jun 2018 11:05:14 -0400 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:38454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQDWG-00037d-68 for emacs-devel@gnu.org; Tue, 05 Jun 2018 11:05:08 -0400 Original-Received: by mail-wm0-x232.google.com with SMTP id m129-v6so5766509wmb.3 for ; Tue, 05 Jun 2018 08:05:07 -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:content-transfer-encoding; bh=Ez55KCqwAGnSTQKAdk3ceuPEK+R8j7KDadkWaVP8JLs=; b=gsW6QGKjDuBfthdE1tLXHRbvZNEBFimyFdhD21zm2Hov8g05P6XOf45xH0oEGzOZrt E6sx/qoh3qMkwedXaZnl5+AgViA2nYbl2P2MT9S+xbahNNb0DbnyPxrNIWjeovcGEZMG Wpv3f1m3GrleNWR/+s0JQN8kRWnRosakDBltTFdcCu7bmgGAAdCPPrHr6XRPSiYdd0h0 cvzTGkResiYoW3PyR0dm2Ku1UzfqnP3mUkf5mYUSmqxmUyX6Q18SBzc2m7Ld8jvep3tY lOO4SjwEzTjEqTGF0l0JmLz3rLLvpSUpD9CHR2W7/1MYrAYEsfbE0wAinVCMoOQoBNg4 xofw== 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:content-transfer-encoding; bh=Ez55KCqwAGnSTQKAdk3ceuPEK+R8j7KDadkWaVP8JLs=; b=akgkMpJ1xHgWAsY5xiyScV7/SmMLviPIHzCc9utW5sPEBQGtI4VKYmE0WuwBmaIFnC Qxu86AAttx0Eu7FbFHWAeLQMEJ4gBP0M4Q8QEagJPd6Xs2+IjOcrzq/4tY7uD93WeH6b fAQ+RLEV1KkGgRsdYirInMmfUleYFlwo6G3f+AQMPSlSOFZumbbTcPA/44a0qseSZA4Z Vv2FPog3jJ41Jl1tBAE0xIA2jnj6Zox3XZnsj6CHNVcNxqiMFQ/5g6nd+nTd1QITwiWR 0TPFxCOYBRUjfLJYgTuWdOimoCQBJ2y7JWMO1OUfCe+nYEPP2yuIeask4hzKJ8bzzk4c JDpg== X-Gm-Message-State: APt69E0KM5llYK8vwqzQlx1p/2Pu+561aB13YhbnPcPBZebNTLz4Qczb SU0XnTWH7H3NAAS3r3uEmnNJKuN2 X-Google-Smtp-Source: ADUXVKJwWgflLqBkzS+Dwj8whue+SqogDeoD54MMvlNnx4VpvSqpK01XxN7kCMusGSfWcLexBL0i4A== X-Received: by 2002:a50:e70d:: with SMTP id a13-v6mr6040492edn.158.1528211106318; Tue, 05 Jun 2018 08:05:06 -0700 (PDT) Original-Received: from localhost ([2a02:8084:4f41:8c80:9c34:da08:a010:edfc]) by smtp.gmail.com with ESMTPSA id k1-v6sm20907179eda.35.2018.06.05.08.05.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 08:05:05 -0700 (PDT) In-Reply-To: (Paul Eggert's message of "Mon, 4 Jun 2018 18:23:39 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 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:226031 Archived-At: Paul Eggert writes: > On 06/04/2018 05:12 AM, Basil L. Contovounesios wrote: >> +(defun list-true-p (object) >> + "Return t if OBJECT is a true list. >> +A true list is neither circular nor dotted (i.e., its last `cdr' >> +is nil)." >> + (null (nthcdr (safe-length object) object))) > > This traverses the list twice. Wouldn't it be better to traverse it just = once? Of course. > Also, why not return the length of the list when it is proper? That would= not > cost anything to compute, and would yield more information than just retu= rning > t. I prefer your suggestion to mine. Would "(elisp) List Elements" be a more appropriate place to document this function then? > Like others, I prefer "proper" to "true". OK, but my question still stands: do we use the term "proper" only to name this function, but keep existing references to "true" lists in the manual? Or do we systematically switch from "true" to "proper", and possibly add a historical sidenote in the manual documenting this change in preferred terminology? > Something like the following, perhaps: > > (defun proper-list-length (obj) > =C2=A0 "Return OBJ's length if OBJ is a proper list, nil otherwise." > =C2=A0 (and (listp obj) (ignore-errors (length obj)))) LGTM. Thanks, --=20 Basil