emacs-devel
[Top][All Lists]
Advanced

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

Re: Instead of pcase


From: Philip Kaludercic
Subject: Re: Instead of pcase
Date: Thu, 16 Nov 2023 07:37:04 +0000

Richard Stallman <rms@gnu.org> writes:

> I can see why people want something along those lines.  Using `cond'
> and `let' to do these jobs feels long-winded and cumbersome; they were
> not designed to make this easy.  So we wish for something to make such
> code more concise.

[...]

> I'm looking at adapting some of the features of `pcase' into other
> constructs, so as to make type-discrimination code more concise than
> in old-fashioned Lisp, but _not_ so concise as to be cryptic and
> burdensome.

The critical feature of pcase is pattern matching.  The complexity of
`pcase' is the extensibility -- a lisp-like flexibility that makes it so
attractive -- that a simpler macro might not need.  The question is, if
one would restrict pcase to just matching expressions using ` and , like

  (pcase sexp ;match various top-level constructs
    (`(defun ,name ,args ,body) ...)
    (`(defvar ,name, ,value) ...)
    (`(require ',symbol) ...)
    ...)

would that be simple enough in your opinion?  Anyone familiar with
ML-style functional programming, Prolog or the notion of unification
should be able to understand this quickly enough, I assume?



reply via email to

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