emacs-devel
[Top][All Lists]
Advanced

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

Re: pcase ` meaning


From: Stefan Monnier
Subject: Re: pcase ` meaning
Date: Tue, 30 Oct 2018 09:14:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> #+BEGIN_SRC ocaml
>   match [1;2;3] with [a;b;c] -> [a;b;c]
> #+END_SRC
>
> But this is a non-primordial side effect.  Notice how in the later case
> the matched data *always* look the same as the pattern (beside replacing
> a number per an identifier): *that’s* the purpose of pattern matching.
> While in the lisp case you got those extra “,”.

That's for a very simple reason: OCaml doesn't have Lisp's symbols, so
its [a;b;c] can't mean "a list containing the symbols a, b, and c".
OCaml still has to distinguish between variables and data constructors,
but instead of using a "," to distinguish the two cases, they force
constructors to be capitalized.


        Stefan




reply via email to

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