From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EFZeMedU5l6HfwAA0tVLHw (envelope-from ) for ; Sun, 14 Jun 2020 16:48:39 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OAU2LedU5l74KgAA1q6Kng (envelope-from ) for ; Sun, 14 Jun 2020 16:48:39 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5E7E7940665 for ; Sun, 14 Jun 2020 16:48:39 +0000 (UTC) Received: from localhost ([::1]:47346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkVoE-0004bf-Ae for larch@yhetil.org; Sun, 14 Jun 2020 12:48:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkVnn-0004ZA-Mx for emacs-orgmode@gnu.org; Sun, 14 Jun 2020 12:48:12 -0400 Received: from latitanza.investici.org ([82.94.249.234]:51989) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkVnl-000157-3n for emacs-orgmode@gnu.org; Sun, 14 Jun 2020 12:48:11 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id E4B901209A6; Sun, 14 Jun 2020 16:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anche.no; s=stigmate; t=1592153277; bh=lKOO4kaI21RKjsRKOzTPewzmSdWi4AHE7pnOD7tPMN0=; h=To:From:Subject:Date:From; b=BU/hJNAu3chNCX20Iao7FCT3MTH7LFwuc/KHw+fUT+PnPQwkNXqZ4kvK+J3dfhhpQ /nksLQouYlg3HzOWTtu7Smh9LZkRMCVkYWNOWg2jNHKFVDS4P9uGkEp4jBofC65neU HYjVaypldn8Lh6iPXMzT4zVRNMlu3X7uqxXaW7oQ= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: mariotomo@inventati.org) by localhost (Postfix) with ESMTPSA id CBE491209A4; Sun, 14 Jun 2020 16:47:56 +0000 (UTC) To: emacs-orgmode@gnu.org From: Mario Frasca Subject: [PATCH] may we focus on readability? Message-ID: Date: Sun, 14 Jun 2020 11:47:31 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------AF9CD0A1710BCD408523FB40" Content-Language: en-US Received-SPF: pass client-ip=82.94.249.234; envelope-from=mario@anche.no; helo=latitanza.investici.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/14 12:47:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=anche.no header.s=stigmate header.b=BU/hJNAu; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.21 X-TUID: nvSpLbaztW+a This is a multi-part message in MIME format. --------------AF9CD0A1710BCD408523FB40 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I'm rewriting a complicated construction where there's an equality test on the length of the list of non matching elements, with a simpler cl-some invocation.  The replacing code is self explanatory. --------------AF9CD0A1710BCD408523FB40 Content-Type: text/x-patch; charset=UTF-8; name="0001-lisp-org-plot.el-reducing-complexity-of-test.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-lisp-org-plot.el-reducing-complexity-of-test.patch" >From 918b0e7ba2db438cc9b81131317501b93a45b1d8 Mon Sep 17 00:00:00 2001 From: mfrasca Date: Sun, 14 Jun 2020 10:52:41 -0500 Subject: [PATCH] lisp/org-plot.el: reducing complexity of test. * lisp/org-plot.el (org-plot/gnuplot): readability of test, looking for some non satisfying elements. I'm rewriting a complicated construction where there's an equality test on the length of the list of non matching elements, with a simpler cl-some invocation. The replacing code is self explanatory. --- lisp/org-plot.el | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index a23195d2a..f50ad09a9 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -312,22 +312,15 @@ line directly before or after the table." ;; Check for timestamp ind column. (let ((ind (1- (plist-get params :ind)))) (when (and (>= ind 0) (eq '2d (plist-get params :plot-type))) - (if (= (length - (delq 0 (mapcar - (lambda (el) - (if (string-match org-ts-regexp3 el) 0 1)) - (mapcar (lambda (row) (nth ind row)) table)))) - 0) + (if (cl-some (lambda (el) + (not (string-match org-ts-regexp3 el))) + (mapcar (lambda (row) (nth ind row)) table)) (plist-put params :timeind t) ;; Check for text ind column. (if (or (string= (plist-get params :with) "hist") - (> (length - (delq 0 (mapcar - (lambda (el) - (if (string-match org-table-number-regexp el) - 0 1)) - (mapcar (lambda (row) (nth ind row)) table)))) - 0)) + (cl-some (lambda (el) + (not (string-match org-table-number-regexp el))) + (mapcar (lambda (row) (nth ind row)) table)))) (plist-put params :textind t))))) ;; Write script. (with-temp-buffer -- 2.20.1 --------------AF9CD0A1710BCD408523FB40--