help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [el-search] How to search string excluding docstring?


From: tomas
Subject: Re: [el-search] How to search string excluding docstring?
Date: Mon, 25 Dec 2017 20:14:20 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Dec 25, 2017 at 07:11:19PM +0100, Emanuel Berg wrote:
> t wrote:
> 
> >> Pattern match, like they have for arguments
> >> in Erlang and SML?
> >
> > Pattern match like pcase, I guess.
> 
> Isn't that the same?

No. Regexps are built to match regular languages. Pcase is
built to match S-expressions, which are beyond regular.
Well-nested parentheses are more than a regular language.

Start with the Chomsky hierarchy[1], and delve as deep as
you like :-)

> AFAIK there isn't any
> native pattern matching i Lisp, but one can do
> it with macros...

whatever you understand by "native pattern matching".

> I don't like it personally because it makes
> writing code neurotic keeping track of all
> those cases, rather than just examine what the
> value is and act accordingly...

It's not a psychological question, but rather a mathematical
one: there are things you can't do with regexps.

> Whenever I use `pcase' it isn't really pattern
> matching in my eyes, i.e. in the Erlang/SML
> sense, more like a way of doing case with
> strings.

There lies your error: you are matching S-expressions, not
strings. The "case" part isn't the exciting one :-)

> I guess it could be used in other ways
> as well. Even tho technically it is the
> same thing.

Hmmm.

Cheers
[1] https://en.wikipedia.org/wiki/Chomsky_hierarchy

- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlpBTgwACgkQBcgs9XrR2kbuAwCdGeCGed8FArdnqKkpQ2sLLnym
SUsAn2Kd5MuqW6LzPW6ZZP0RzXQNlEoA
=F3k5
-----END PGP SIGNATURE-----



reply via email to

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