- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Michael Hanus <mh_at_informatik.uni-kiel.de>

Date: Fri, 31 Oct 2014 15:48:56 +0100

On 10/31/2014 06:16 AM, lausgans_at_gmail.com wrote:

*> Actually, an infix disjunction is what interests me more, less is where it resides. Is there such in Curry?
*

I am not sure what you mean, but there is the prelude operator "?"

which denotes a choice and, thus, on the constraint level,

a disjunction.

*>> The only tricky issue is to retain unification, if possible.
*

*>> For instance, in the initial expression
*

*>>
*

*>> x==[1,2] where x free
*

*>>
*

*>> one would like to bind x to the list [1,2] instead of instantiating
*

*>> x to all integer lists and produce False for all lists except [1,2].
*

*>> However, this could be easily expressed by
*

*>>
*

*>> solve (x==[1,2]) where x free
*

*>
*

*> The idea is cool, but isn’t it a case where some people will forget to use solve() resulting in performance degradation of their programs?
*

The point is that "solve" is only necessary for top-level expressions

where a bigger context is missing.

If "==" is used on conditions, it can be transformed into unification.

If "==" is used in an if-then-else, it cannot be transformed but

this is intended (for the sake of completeness) since one is interested

in "True" as well as "False" results.

*> No, i’ve used this in a pure logic context. Isn’t it possible to extend unification to support such syntax, or i miss something?
*

Unification has no specific syntax (in contrast to pattern matching),

i.e., "=:=" is an infix operator as any other infix operator.

For instance, you might redefine it by

x `unify` y = x =:= y

Hence, it seems difficult to provide a specific syntax for it.

Best regards,

Michael

_______________________________________________

curry mailing list

curry_at_lists.RWTH-Aachen.DE

http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Fr Okt 31 2014 - 16:17:38 CET

Date: Fri, 31 Oct 2014 15:48:56 +0100

On 10/31/2014 06:16 AM, lausgans_at_gmail.com wrote:

I am not sure what you mean, but there is the prelude operator "?"

which denotes a choice and, thus, on the constraint level,

a disjunction.

The point is that "solve" is only necessary for top-level expressions

where a bigger context is missing.

If "==" is used on conditions, it can be transformed into unification.

If "==" is used in an if-then-else, it cannot be transformed but

this is intended (for the sake of completeness) since one is interested

in "True" as well as "False" results.

Unification has no specific syntax (in contrast to pattern matching),

i.e., "=:=" is an infix operator as any other infix operator.

For instance, you might redefine it by

x `unify` y = x =:= y

Hence, it seems difficult to provide a specific syntax for it.

Best regards,

Michael

_______________________________________________

curry mailing list

curry_at_lists.RWTH-Aachen.DE

http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Fr Okt 31 2014 - 16:17:38 CET

*
This archive was generated by hypermail 2.3.0
: Do Sep 21 2023 - 07:15:10 CEST
*