From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: Internationalize Emacs's messages (swahili) Date: Sun, 27 Dec 2020 15:41:15 -0800 (PST) Message-ID: <992f9ecc-1436-430c-b5f2-7f88899b53a1@default> References: <87o8ivumn5.fsf@telefonica.net> <86sg7w39fh.fsf@163.com> <83pn30pku5.fsf@gnu.org> <86wnx8otoj.fsf@163.com> <834kkbp9vr.fsf@gnu.org> <87czyxuxw6.fsf@db48x.net> <87y2hlt82w.fsf@db48x.net> <87lfdlvsw4.fsf@logand.com> <83h7o8ncly.fsf@gnu.org> <87pn2wudab.fsf@db48x.net> <87mty0c3m1.fsf@gnus.org> <83czywnb86.fsf@gnu.org> <87im8ob707.fsf@gnus.org> <87eejcb6nx.fsf@gnus.org> <875z4ob5c9.fsf@gnus.org> <87a6u09nkq.fsf@gnus.org> <875z4o9jdg.fsf@gnus.org> <87r1nb8yoj.fsf@gnus.org> <83blefkte2.fsf@gnu.org> <87h7o69aa8.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35519"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Lars Ingebrigtsen , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 28 00:42:15 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ktffz-00099E-Kv for ged-emacs-devel@m.gmane-mx.org; Mon, 28 Dec 2020 00:42:15 +0100 Original-Received: from localhost ([::1]:38854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktffy-000365-Nt for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Dec 2020 18:42:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktffB-0002Ij-9d for emacs-devel@gnu.org; Sun, 27 Dec 2020 18:41:25 -0500 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:41370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktff9-0008Ui-2h; Sun, 27 Dec 2020 18:41:24 -0500 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BRNdtF8006470; Sun, 27 Dec 2020 23:41:20 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-2020-01-29; bh=5tmZXDDNl6yv+KTOGfzC5HLElDKujqA0YDjThrXLV/E=; b=hqssAaW8TT+rnsaB1aeJnavbxWPp1IAjjODksJoRpD2gSH5m6gIZ6TKXEKyf3pj1k+Zy COJ9JM0InlOXLs9EDnpwRCEaVWOlHhMrn0NlSuU0Ybl7AQgm0rpM3VhowT+gNweQ/1Tu u2PN8tD2kwuyQrE2AtxkRNpcVyws5Aehn7QVLd0wKrb7hhJEVURh/cZeyurG8GL4E1LS gb11DT24Uk2RzAY/Pi2r4uPSG8Mx+eWfNcxaV52kmBChyUNE13ED5ZQaQjjhvXJC4F9w GKfObkjUZOioCxkjiiHnDRrxyeIr3k+2HBseCrYWKpBvUtSHZGmj6hOSVTawvjZIYCQ9 lA== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 35phm1943e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 27 Dec 2020 23:41:20 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BRNat9n120670; Sun, 27 Dec 2020 23:41:19 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 35pf2vpwdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 27 Dec 2020 23:41:19 +0000 Original-Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0BRNfGoQ022274; Sun, 27 Dec 2020 23:41:17 GMT In-Reply-To: <87h7o69aa8.fsf@gnus.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5095.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9847 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=978 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012270151 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9847 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=993 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012270151 Received-SPF: pass client-ip=141.146.126.78; envelope-from=drew.adams@oracle.com; helo=aserp2120.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.041, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261953 Archived-At: > Yes, I think <, =3D and > are the ones that are nice to have. The /=3D, = <=3D > and >=3D are trivial to express via the others, so I didn't go there. I agree with Stefan. If you insist on defining such predicates, please just do it in Lisp. (defun length> (xs n) "Return non-nil if length of sequence XS is greater than N." (if (consp xs) (nthcdr n xs) (> (length xs) n))) (defun length< (xs n) " Return non-nil if length of sequence XS is less than N." (if (consp xs) (null (nthcdr (1- n) xs)) (< (length xs) n))) (defun length=3D (xs n) " Return non-nil if length of sequence XS is N." (if (consp xs) (let ((ys (nthcdr (1- n) xs))) (and ys (null (cdr ys)))) (=3D (length xs) n))) or similar... ___ Of course, those can give values for some inputs where the list is dotted, and raise errors for others. But so can the C implementation you showed for `length<', IIUC. And testing for a `proper-list-p' anyway means traversing the full list. This is another reason I'm not crazy about Emacs adding and promoting such predicates. Better for users to try to DTRT in any particular case. Promoting these is likely to encourage blind use. At a minimum, the doc should say that if you want to be sure a returned value makes sense then be sure the list arg is a proper list. ___ An alternative (better, IMO), is to have such predicates always return a nil or non-nil value. The following definitions do that. For these definitions a dotted list acts just like the same list without the dot, i.e., an atomic last cdr Z is treated like (Z). So the dotted list (a b . c) behaves for these predicates just like (a b c). And they apparently work fine for circular lists also. (defun length> (xs n) "Return non-nil if length of sequence XS is greater than N." (if (atom xs) (> (length xs) n) (condition-case nil (nthcdr n xs) (error nil)))) (defun length< (xs n) "Return non-nil if length of sequence XS is less than N." (if (atom xs) (< (length xs) n) (condition-case nil (null (nthcdr (1- n) xs)) (error t)))) (defun length=3D (xs n) "Return non-nil if length of sequence XS is N." (if (atom xs) (=3D (length xs) n) (condition-case nil (let ((ys (condition-case nil (nthcdr (1- n) xs) (error nil)))) (and ys (null (cdr ys)))) (error t))))