Re: Curry syntax

From: Andy Jost <Andrew.Jost_at_synopsys.com>
Date: Fri, 10 Mar 2017 22:34:37 +0000

Hi Wolfgang,

Is there some difference between let bindings and where bindings in this regard? It seems if the functional pattern you show could work in a "let" context, then it should also work in a "where" context. Is this an MCC extension?

I see your points and take them well. I think the nub of my suggestion (which I now see more clearly) is to interpret an expression in a binding context as a constraint. So, something like:

        let length x == 3 in x
                OR
        x where length x == 3

There's no use for this in a functional setting, but in Curry it has meaning. I don't know how much the syntax would be disturbed, but it seems possible that ambiguities could be introduced by allowing this.

I think my intuition comes from the "let x free in ..." and "... where x free" constructs. Those already don't bind x, but establish a property regarding it.

Anyway, I don't disagree that this could be a disruptive change.

-Andy

-----Original Message-----
From: Wolfgang Lux [mailto:wolfgang.lux_at_gmail.com]
Sent: Thursday, March 9, 2017 2:38 PM
To: Andy Jost <Andrew.Jost_at_synopsys.com>
Cc: Michael Hanus <mh_at_informatik.uni-kiel.de>; curry_at_lists.RWTH-Aachen.DE
Subject: Re: Curry syntax


> Am 09.03.2017 um 17:42 schrieb Andy Jost <Andrew.Jost_at_synopsys.com>:
>
> Yes, this is syntactic sugar only. The reason I thought of it: I was trying demonstrate in an introductory way how easy it is to produce a constrained value in Curry. But using &> forces me to explain success and failure, and introduces a "funny" operator. In the end, I felt the demonstration would only give the impression that this sort of thing is technical and complicated, not simple and intuitive like I had hoped.

I see what you are trying to get to. My concern is that the where keyword currently introduces a list of bindings, while in your proposal it would be introducing a list of expressions. My feeling is that in the end using where for two different purposes is going to create more confusion than you gain by the new syntax.

<shameless-plug>
Incidentally, you could use function patterns in mcc to achieve (almost) the same effect with a let expression:
  let (length x) = 3 in x
Note that the parentheses around length x are important to make this a pattern binding.
</shameless-plug>

Wolfgang

_______________________________________________
curry mailing list
curry_at_lists.rwth-aachen.de
https://mailman.rwth-aachen.de/mailman/listinfo/curry


Received on So Mär 12 2017 - 18:44:08 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:13 CEST