From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kevin Vigouroux via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Find the longest word in the word list file. Date: Thu, 12 Aug 2021 16:47:47 +0200 Message-ID: <87pmuiyb1o.fsf@laposte.net> References: <87a6loarpi.fsf@zoho.eu> <87y297xtjc.fsf@zoho.eu> Reply-To: Kevin Vigouroux Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24583"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 12 16:50:03 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1mEC1y-00068g-Hf for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 12 Aug 2021 16:50:02 +0200 Original-Received: from localhost ([::1]:43514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEC1x-0007VL-In for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 12 Aug 2021 10:50:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEC1d-0007Uy-Mh for help-gnu-emacs@gnu.org; Thu, 12 Aug 2021 10:49:41 -0400 Original-Received: from smtp-outgoing-1703.laposte.net ([160.92.124.101]:41776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEC1a-0003l2-V0 for help-gnu-emacs@gnu.org; Thu, 12 Aug 2021 10:49:41 -0400 X-mail-filterd: {"version":"1.2.2", "queueID":"4GlqKx0TV3z10MQP", "contextId":"637c7713-c428-4157-ba6f-33fc75108d43"} Original-Received: from outgoing-mail.laposte.net (localhost.localdomain [127.0.0.1]) by mlpnf0103.laposte.net (SMTP Server) with ESMTP id 4GlqKx0TV3z10MQP for ; Thu, 12 Aug 2021 16:47:49 +0200 (CEST) X-mail-filterd: {"version":"1.2.2", "queueID":"4GlqKw69Xhz10MQM", "contextId":"418777b1-8c78-4ce4-8799-169f9ccee985"} X-lpn-mailing: LEGIT X-lpn-spamrating: 40 X-lpn-spamlevel: not-spam X-lpn-spamcause: OK, (0)(0000)gggruggvucftvghtrhhoucdtuddrgedvtddrkeefgdejlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfntefrqffuvffgpdfqfgfvpdggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufhfffgjkfgfgggtgfesthhqredttderjeenucfhrhhomhepmfgvvhhinhcugghighhouhhrohhugicuoehkvgdrvhhighhouhhrohhugieslhgrphhoshhtvgdrnhgvtheqnecuggftrfgrthhtvghrnhepveethfffkeeiffeklefhgeettefgvedtkeeiieekjeegledtvdfffeetieejuedunecuffhomhgrihhnpegurghtrghsfigrmhhprdhorhhgnecukfhppedutdelrddvudekrddufedurdeggeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegrrhgrghhoghdpihhnvghtpedutdelrddvudekrddufedurdeggedpmhgrihhlfhhrohhmpehkvgdrvhhighhouhhrohhugieslhgrphhoshhtvgdrnhgvthdprhgtphhtthhopehhvghlphdqghhnuhdqvghmrggtshesghhnuhdrohhrgh Original-Received: from aragog (arennes-653-1-292-44.w109-218.abo.wanadoo.fr [109.218.131.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mlpnf0103.laposte.net (SMTP Server) with ESMTPSA id 4GlqKw69Xhz10MQM for ; Thu, 12 Aug 2021 16:47:48 +0200 (CEST) Mail-Followup-To: help-gnu-emacs@gnu.org In-Reply-To: <87y297xtjc.fsf@zoho.eu> (Emanuel Berg via Users list for the's message of "Thu, 12 Aug 2021 04:53:43 +0200") DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=laposte.net; s=lpn-wlmd; t=1628779767; bh=Ly3utQw2duSRtsvMhMPYzAKWKJPdencebKYO/asj46I=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; b=XLm+MwifNahu94Y2PEoBUdNz9IK4f8mYZ5LSPatBjXOFERwA1TxiISencxhJNmTo8vXhN0HsuhZBIjMSn9RMJbdbR5ia+z8HrEnk8GJijc+2M2dTDGtkDInq/4ajTVxUDgJXvWsUaogLuTMzwM3xQvRTGz7m6ZGjAVx3CLhMMMhKtl1XibbDvOit7ofUCWw2tri+JuuiJU1Qp2sqi3x00PLS620+kAQgYFqB5SOgQJuMMhQOVMakmi7qbTHF/k6jqJEIBrbcNISr5VXQMMS1kkFl3zo2I7aUmBHsgfTAk7O1re/qN0wmdmtIOd4STZClzh8fOySNDD5QY+gjoj6mmg==; Received-SPF: pass client-ip=160.92.124.101; envelope-from=ke.vigouroux@laposte.net; helo=smtp-outgoing-1703.laposte.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:132482 Archived-At: Emanuel Berg via Users list for the GNU Emacs text editor writes: > Hongyi Zhao wrote: > >> I don't think so. Whether you start completely from scratch, >> with elisp, there are so many selections for doing such >> a thing. This way can give us a deeper understanding of >> algorithms and how computers work. > > Here you go, > > (defun sort-lines-length (beg end) > (interactive (if (use-region-p) > (list (region-beginning) (region-end)) > (list (point-min) (point-max)) )) > (save-excursion > (save-restriction > (narrow-to-region beg end) > (goto-char (point-min)) > (sort-subr nil > #'forward-line > #'end-of-line > nil nil > (lambda (a b) (> (- (cdr a) (car a)) > (- (cdr b) (car b)) )))))) > (defalias 'sll #'sort-lines-length) > > https://dataswamp.org/~incal/emacs-init/sort-incal.el lines 18-32 How do we know that the =E2=80=9Csort key=E2=80=9D is a cons cell? --=20 Best regards, Kevin Vigouroux