From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Imports / inclusion of s.el into Emacs Date: Sun, 3 May 2020 15:13:43 +0100 Message-ID: References: <87ftchy0go.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="53285"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , Stefan Monnier , Richard Stallman , Emacs developers To: Philippe Vaucher Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 03 16:14:47 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 1jVFOI-000DjW-PT for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 16:14:46 +0200 Original-Received: from localhost ([::1]:50152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVFOH-00045Y-TE for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 10:14:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVFNV-0002gR-VA for emacs-devel@gnu.org; Sun, 03 May 2020 10:13:57 -0400 Original-Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:37305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVFNU-0005co-Od; Sun, 03 May 2020 10:13:57 -0400 Original-Received: by mail-io1-xd2b.google.com with SMTP id u11so9632326iow.4; Sun, 03 May 2020 07:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=PVD8tJLPhakpJxR+l7FbHiOH1DkRWKg1L/gqfOafby8=; b=J3Tr/vyLkvevxXZO/Ch+p5bH1yS+y8MLKJSYPbdRCIs2pBKQMA7ufgkar2T2LnUETB /uqTLYPJD305vJjB3IingZ/mBrZ7pCO88F/8V+/uy/fRzPRKgMsMDGIT7nOAHNfQMq8v 7k9XIcT/gH7iVnBkmnyyzYWHW4Cobd/IRcNXhtpqZ3exCHvdYKDF9Rs1+hmPYehfzQ7a xP9C9gJQgGkGqeGjU8GykUF5lbBVs7ke7wwNRmhLzfiGrCzyX8M2EKU4bFJpqvXHThZd BFWH9GyFIoPtEXbSeMN0fetpLYCxipOOcX9enKcLYrCRf0DVW2WeahNJf5+snO63CDK8 VZ7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PVD8tJLPhakpJxR+l7FbHiOH1DkRWKg1L/gqfOafby8=; b=JHm+vWeRIuIqDVKEB8nZx2BbnpBwuUFQ01R5SwJ/ituK2zo2sDM4DCU0IulUAFFZAw 2PwtWm9CWcR4NA+rvxpKa8Xsd0dsptdK31f9AuTYezd16MTJUUiWmVJE6QN0SRbxrL8t Pv1JvLcgRGFJTeYYyCt9vPkNfH1g4pAM7OxJy04ob4QsTnNrO5BTYzDV0XG61Yy/TXN6 c/limRLJ/PHDdfqTn9tazuXKku94NlNuOXpkZsG0RT08lFctSON0Kj7MmGlFmAyeZ8z2 USr8AUxHvP7BacSOnlOjUTfiWOAzOvIfSLmNwtKmBtqHctqpXRcqr72SqgZLt9AYlBkm bHZw== X-Gm-Message-State: AGi0PuaY02BDzhCftHASvXGxKuJSYWCPztxjhFi48rvWdLY4uT6ByfnP 8M4dRU3h42C8y4Ecp3miq5IUdLZWa84S5JS8ETY= X-Google-Smtp-Source: APiQypLF48sb/0O0/3PhTxEDeI5xR4ImtlZ88tzvGIhS5ZMmIFSYYHZVA50PUhmDt+t+vVAmzKE7ZUYG/1JICOjs59g= X-Received: by 2002:a02:205:: with SMTP id 5mr10740612jau.78.1588515235335; Sun, 03 May 2020 07:13:55 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::d2b; envelope-from=joaotavora@gmail.com; helo=mail-io1-xd2b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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:248685 Archived-At: On Sun, May 3, 2020 at 2:47 PM Philippe Vaucher wrote: > > >> split-string aliased as string-split > >> downcase aliased as string-downcase > >> upcase aliased as string-upcase > >> format aliased as string-format > >> concat aliased as string-concat > > >Don't do this. Just learn these 5 names, or use apropos, as > > has been suggested. > > Just curious, if these were to be introduced today, would you also name t= hem that way? I don't know, honestly. But that is not relevant. We are not starting an universe from scratch. > What possible genericity is there about downcase/upcase? Okay they work o= n strings and on chars, > but it's pretty clear their topic is "characters" (string) no? Always and forever? Are strings, one-dimensional sequences of characters by definition, the only thing you can think about that involves characters whose case can be mutated? > > Check out http://www.lispworks.com/documentation/HyperSpec/Body/f_stg_u= p.htm and http://www.lispworks.com/documentation/HyperSpec/Body/c_string.ht= m > > > Do you think this organization would be useful? What if it had a cool > > font and some cool logos? :-) I ask because that put me off at first, = it > > looked mouldy.) > > Yes, that'd be very useful and it's more or less what we are asking > to be able to do. Again curious, do you think they made a mistake > when they named it `string-downcase` there and not `downcase`? It only works on strings in CL, but characters are defined to be "singleton string designators", a common concept in CL. Maybe they couldn't quite decide on a generic version. You see CL didn't come from nothing, it was a giant and very expensive effort to reconcile a _lot_ of competing Lisps. > >> s-truncate (len s) > > truncate-string-to-width (I got there with apropos truncate.*string btw= ). > > Okay then let's alias that to string-truncate. To achieve what? I would only bring confusion. Also to the s.el cool kids, they would be equally confused, since the arguments are reversed. > >> s-left (len s) > >subseq > >> s-right (len s) > > Add an "from-end" arg to subseq? > > Why is there substring if there is subseq then? =C2=AF\_(=E3=83=84)_/=C2=AF History? substring has both optional args. Use substring if you absolutely know your sequence is a string, subseq otherwise. > >> s-repeat (num s) > > (cl-loop repeat num concat s) > > What if I don't know cl (like I a significant number of package authors) = ? I think you might want to learn how to loop if you're going to program. You can use while, do, etc. cl-loop is just my favourite. I don't think this function needs to be in a library, but maybe an example of how do this can be in one of those boring paragraphs of the manual. > >> s-capitalize (s) > > capitalize, also works for chars. > Alias it to string-capitalize :-) I guess if I was starting from scratch I would do that. We're not. But ma= ybe. > >> s-reverse (s) > > reverse, also works for sequences > > Ah, this one I didn't think worked on strings. Thought you have to split, > reverse then join. I agree this can be left as a generic algorithm. Good. > >> s-contains-p (needle s &optional ignore-case) > > string-match-p > That can work, tho the mental path of having to do a regexp match > while regexp-quoting the string just to do a plain text search feels very= inneficient. Well, I honestly had to look up the doc if "needle" was a string or a character. So that mental path is quite worse for me. > >> s-blank-p (s) > > ugh. nil is a string? > "is the string blank?" is a concept in many languages, > but I understand it can be surprising at first. Yes, things are suprising at first, then you learn them. Get the hint? ;-) Jo=C3=A3o T=C3=A1vora