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.
-Andy
-----Original Message-----
From: Michael Hanus [mailto:mh_at_informatik.uni-kiel.de]
Sent: Thursday, March 9, 2017 2:29 AM
To: Wolfgang Lux <wolfgang.lux_at_gmail.com>; Andy Jost <Andrew.Jost_at_synopsys.com>
Cc: curry_at_lists.RWTH-Aachen.DE
Subject: Re: Curry syntax
On 03/09/2017 09:25 AM, Wolfgang Lux wrote:
>
>> Am 08.03.2017 um 19:46 schrieb Andy Jost <Andrew.Jost_at_synopsys.com>:
>>
>> I wonder if anyone has ever thought about allowing a “where” clause with conditions in a Curry expression. For instance, I wish this were a valid expression:
>>
>> (x where length x == 3)
>>
>> (I also like to assume unbound variables are free, but that’s a
>> different topic.)
>>
>> Any thoughts?
>
> Isn't this already possible with (length x == 3 &> x) in Curry now?
> Or am I missing something?
I also thought of the same construction.
There is still one issue to discuss: the scope of x.
If x should be visible like any other object introduced in a where clause, one can write it as
where x = let x free in length x == 3 &> x
Best regards,
Michael
_______________________________________________
curry mailing list
curry_at_lists.rwth-aachen.de
https://mailman.rwth-aachen.de/mailman/listinfo/curry
Received on Do Mär 09 2017 - 18:45:09 CET