From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25826: 26.0.50; cl-mapc and cl-mapl do needless consing Date: Wed, 22 Feb 2017 20:55:58 -0500 Message-ID: <8737f5hdqp.fsf@users.sourceforge.net> References: <87d1ecyno9.fsf@calancha-pc> <87shn7hdbx.fsf@users.sourceforge.net> <87lgsyncr1.fsf@calancha-pc> <87efyqhpb5.fsf@users.sourceforge.net> <87y3wyojzu.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1487814920 24741 195.159.176.226 (23 Feb 2017 01:55:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Feb 2017 01:55:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 25826@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 23 02:55:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1cgici-0005SF-70 for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Feb 2017 02:55:12 +0100 Original-Received: from localhost ([::1]:55946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgicm-00076d-Di for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Feb 2017 20:55:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgicf-000753-BB for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 20:55:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgicY-0004RA-WC for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 20:55:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cgicY-0004Qc-SX for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 20:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cgicY-0001Gs-GP for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 20:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2017 01:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25826 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25826-submit@debbugs.gnu.org id=B25826.14878148944867 (code B ref 25826); Thu, 23 Feb 2017 01:55:02 +0000 Original-Received: (at 25826) by debbugs.gnu.org; 23 Feb 2017 01:54:54 +0000 Original-Received: from localhost ([127.0.0.1]:51732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgicQ-0001GR-EV for submit@debbugs.gnu.org; Wed, 22 Feb 2017 20:54:54 -0500 Original-Received: from mail-it0-f48.google.com ([209.85.214.48]:37440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgicP-0001GC-45 for 25826@debbugs.gnu.org; Wed, 22 Feb 2017 20:54:53 -0500 Original-Received: by mail-it0-f48.google.com with SMTP id 203so1463199ith.0 for <25826@debbugs.gnu.org>; Wed, 22 Feb 2017 17:54:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=6Qj0CdTw92Y+kzKF7Fj950+CxkaireaSP8307LgRPE8=; b=YOjlVW03iv7MncG2QN+zgM/cdnrLW6szhxvusFsgaJb+nVO+/MczuXEacEEjnu7mrb 4Rw186NRogbankEnAfsfrCcsSNIHy0J3vxsodenD2sP5jWXU4Pmqxuy1Ch0oLvJa9NEO a05ygODGI1vySG53IJZFiUkdJ6K+3/Xxbzeo8J6DTn24Vv1gT+ipGm6j5EmainS9ZLaw 2AprymAKAUnA4GLr0mQv0q11VziueplOijl+6Q7WFCVYqiKBsFk5BP5LUm/lh+76PRql OYlTRPHYFuC1SPokojRKclgAV4n465myHzVix6/Gv/Gspt9MlUx3W6+rNEjz8ToiPng6 fnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=6Qj0CdTw92Y+kzKF7Fj950+CxkaireaSP8307LgRPE8=; b=BxrtIqbv7IIz65J5uq9NBYBDeVrEgvFu6RS608tWiBxbedV2QHrzrDAoxTGzXDV32u OEttDgJNYt7VeM1v9g2JY4ic7pXF++bvlmTatSq4j36F58mPCbXyK6pGamaCmwa90N3F 9NI/0GVtIY/cKeJuKIPmBGCJpmQOrYhg71FbEsKrRpGAc6aaUELFowGfRqJSuFb4xUH2 i2SpavcyaAV7OZaQcigULQxCWawr/6WXFYQ3iLSNSlcwfCn6yZWDPINWAKS9jgWdlaLH UtdPfq0kxmUerJeVHBbMUsM1KK9OukCAu4xmqc3RrXBKzq6sSimzVdhyfn+iEPY4ZlnZ JQdA== X-Gm-Message-State: AMke39m1FkgpoL2hza3eZslyizXugPuV0ZVcP/LvwP8niIdE6PV4CV7eewQeG8c9bskFfg== X-Received: by 10.36.208.134 with SMTP id m128mr1123828itg.44.1487814887107; Wed, 22 Feb 2017 17:54:47 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id t39sm1274635ioe.12.2017.02.22.17.54.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Feb 2017 17:54:45 -0800 (PST) In-Reply-To: <87y3wyojzu.fsf@calancha-pc> (Tino Calancha's message of "Wed, 22 Feb 2017 14:46:45 +0900") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129669 Archived-At: --=-=-= Content-Type: text/plain Tino Calancha writes: > It's tricky to write a test to check if cl-mapc/cl-mapl over cons. > Thus, i have written tests that just ensure the return values > are as expected. We should check that the args are consp at least: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-fixup-Prevent-for-consing-in-cl-mapc-and-cl-mapl.patch Content-Description: fixup patch >From aed9f2462f7825b1dddbdf20fa5aa9b74a51ca72 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 22 Feb 2017 20:46:12 -0500 Subject: [PATCH] fixup! Prevent for consing in cl-mapc and cl-mapl --- test/lisp/emacs-lisp/cl-extra-tests.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el index 82b2206a6c..5b2371e7b9 100644 --- a/test/lisp/emacs-lisp/cl-extra-tests.el +++ b/test/lisp/emacs-lisp/cl-extra-tests.el @@ -39,9 +39,9 @@ (let ((lst '(a b c)) (lst2 '(d e f)) (lst3 '(1 2 3)) - (fn1 (lambda (x) nil)) - (fn2 (lambda (x y) nil)) - (fn3 (lambda (x y z) nil))) + (fn1 (lambda (_x) nil)) + (fn2 (lambda (_x _y) nil)) + (fn3 (lambda (_x _y _z) nil))) (should (equal lst (cl-mapc fn1 lst))) (should (equal lst (cl-mapc fn2 lst lst2))) (should (equal lst (cl-mapc fn3 lst lst2 lst3))))) @@ -50,9 +50,9 @@ (let ((lst '(a b c)) (lst2 '(d e f)) (lst3 '(1 2 3)) - (fn1 (lambda (x) nil)) - (fn2 (lambda (x y) nil)) - (fn3 (lambda (x y z) nil))) + (fn1 (lambda (x) (should (consp x)))) + (fn2 (lambda (x y) (should (and (consp x) (consp y))))) + (fn3 (lambda (x y z) (should (and (consp x) (consp y) (consp z)))))) (should (equal lst (cl-mapl fn1 lst))) (should (equal lst (cl-mapl fn2 lst lst2))) (should (equal lst (cl-mapl fn3 lst lst2 lst3))))) @@ -62,8 +62,8 @@ (lst2 '(d e f)) (lst3 '(1 2 3)) (fn1 (lambda (x) x)) - (fn2 (lambda (x y) y)) - (fn3 (lambda (x y z) z))) + (fn2 (lambda (_x y) y)) + (fn3 (lambda (_x _y z) z))) (should (equal lst (cl-mapcar fn1 lst))) (should (equal lst2 (cl-mapcar fn2 lst lst2))) (should (equal lst3 (cl-mapcar fn3 lst lst2 lst3))))) @@ -73,8 +73,8 @@ (lst2 '(d e f)) (lst3 '(1 2 3)) (fn1 (lambda (x) x)) - (fn2 (lambda (x y) y)) - (fn3 (lambda (x y z) (string-to-char (format "%S" x))))) + (fn2 (lambda (_x y) y)) + (fn3 (lambda (x _y _z) (string-to-char (format "%S" x))))) (should (equal lst (cl-map 'list fn1 lst))) (should (equal (vconcat lst2) (cl-map 'vector fn2 lst lst2))) (should (equal (mapconcat (lambda (x) (format "%S" x)) lst "") @@ -84,9 +84,9 @@ (let ((lst '(a b c)) (lst2 '(d e f)) (lst3 '(1 2 3)) - (fn1 (lambda (x) x)) - (fn2 (lambda (x y) y)) - (fn3 (lambda (x y z) z))) + (fn1 (lambda (x) (should (consp x)) x)) + (fn2 (lambda (x y) (should (and (consp x) (consp y))) y)) + (fn3 (lambda (x y z) (should (and (consp x) (consp y) (consp z))) z))) (should (equal (list lst (cdr lst) (cddr lst)) (cl-maplist fn1 lst))) (should (equal (list lst2 (cdr lst2) (cddr lst2)) -- 2.11.1 --=-=-=--