[Top][All Lists]

[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)

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.



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


reply via email to

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