[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
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], (continued)
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Michael Heerdegen, 2018/10/28
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Michael Heerdegen, 2018/10/29
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning, Michael Heerdegen, 2018/10/29
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning, Michael Heerdegen, 2018/10/29
- Re: pcase ` meaning, Yuri Khan, 2018/10/30
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Clément Pit-Claudel, 2018/10/29
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning,
Stefan Monnier <=
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/31
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/28
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/29
- What `case' have done you? [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/29
- Re: What `case' have done you? [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Michael Heerdegen, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/31