[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Imports / inclusion of s.el into Emacs

From: Philippe Vaucher
Subject: Re: Imports / inclusion of s.el into Emacs
Date: Sun, 3 May 2020 16:27:52 +0200

> What possible genericity is there about downcase/upcase? Okay they work on 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?

Oh, it's designed for possible future structure in mind? While an interesting point I think it's a bit far fetched.

> > 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.

Can you stop with the "cool kids" labelling? I mean we are all old farts here :-P I just happen to have learnt both ways (readings lots of C++ books then eating lots of Ruby tutorials) and both are useful depending on what you do.

> >> 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?

¯\_(ツ)_/¯ History?  substring has both optional args.
Use substring if you absolutely know your sequence
is a string, subseq otherwise.

Thanks for the clarification.

> >> 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.

The implication that I don't know how to do loops is a bit mean, but I'll let that pass. I don't know `cl` (tho I copy-pasted some in the past), but I do know loops. I was always somewhat taught that `cl` was not _really_ emacs lisp so you should not use it. Maybe that's wrong.

> >> 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.

Again very interesting: needle and haystack is also a metaphor used in many languages. It's another point where I'd have thought you were trolling if you didn't understand!

> >> 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? ;-)


Maybe a bit of information that can be useful for you is that I code packages since a while now, for example https://github.com/Silex/docker.el

It's been years since I use Emacs. I obviously never took the proper time to learn it in full depth but I'm not a "newbie".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]