From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Transposing words over middle words Date: Fri, 17 Nov 2017 01:39:07 +0100 Message-ID: <86d14h4u38.fsf@zoho.com> References: <86efoxvn8i.fsf@verizon.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1510879200 5526 195.159.176.226 (17 Nov 2017 00:40:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Nov 2017 00:40:00 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 17 01:39:52 2017 Return-path: Envelope-to: geh-help-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 1eFUhE-00011i-EO for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Nov 2017 01:39:52 +0100 Original-Received: from localhost ([::1]:43394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFUhL-0002CI-L2 for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Nov 2017 19:39:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFUgp-0002C2-VH for help-gnu-emacs@gnu.org; Thu, 16 Nov 2017 19:39:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFUgm-0007mH-Qk for help-gnu-emacs@gnu.org; Thu, 16 Nov 2017 19:39:27 -0500 Original-Received: from [195.159.176.226] (port=46963 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eFUgm-0007lO-Jy for help-gnu-emacs@gnu.org; Thu, 16 Nov 2017 19:39:24 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eFUgW-0006vb-Lv for help-gnu-emacs@gnu.org; Fri, 17 Nov 2017 01:39:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 62 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:zrq9D9P5w96e13oQ022/vIof9gc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114923 Archived-At: Joseph C. Fineman wrote: >> TL;DR: How can I transpose words jumping >> over middle words? > > I think that, rather than expending > cleverness on that particular problem, and > then trying to remember the result,I would > write a command that solved a more general > problem In general, it isn't better to try to solve the general problem. The layman mechanic might think an adjustable spanner is superior to a (fixed size) combination spanner (the "U-ring") - but on the contrary, it is much worse, at least as long as you have the whole set of metric and imperial sizes - and if you don't, that's another issue. Specific gear for specific purposes is what wins the day. In programming, it is better to solve the specific problem first, like this (count-to-five) ; 1 2 3 4 5 Only when you realize you need to count to four as well you might consider (count-to x) ; 1 .. x and (count-to 4) (count-to 5) But even there, this (count-to-five) (count-to-four) isn't always wrong. It depends. (This is a toy example, of course.) > & would be easy to remember. Unless there is DWIM interface I'd say the general solution can be less easy to remember as you need to feed it argument(s) and/or tweak it for the particular situation. Which is slower than the specific solution, both invocation and execution, as well. General solutions are more good-looking tho :) And you can have both at the same time! Remember, "make the common [frequent] case fast and the rare case correct." -- underground experts united http://user.it.uu.se/~embe8573