let function

Alan Schmitt alan.schmitt at polytechnique.org
Wed May 20 13:45:53 UTC 2015

On 2015-05-19 18:24, Steve Fink <sphink at gmail.com> writes:

> On 05/19/2015 12:23 AM, Alan Schmitt wrote:
>> On 2015-05-19 06:09, Bergi <a.d.bergi at web.de> writes:
>>> Alternatively just use a single equals sign with a parameter list:
>>> let f(x) = y
>>> let f() = y
>> This looks very nice indeed.
> That visually collides with destructuring for me.
> let [a, b] = foo();
> let {a, b} = foo();
> let f(a, b) = foo(); # Very different
> I almost expect that last one to use f as a custom matcher of some sort, given
> the previous two.

It is actually how it works in Ocaml: in "let f p = …", p is a pattern,
which may destructure tuples such as the pair (a,b) above, or other
constructs as long as they are not part of an alternation (where several
cases may occur).



OpenPGP Key ID : 040D0A3B4ED2E5C7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150520/1f6317c7/attachment.sig>

More information about the es-discuss mailing list