Re: Help using currypp

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Sun, 2 Apr 2017 13:13:25 +0200

On 01.04.2017 19:09, James Koppel wrote:
> I see that the implementation uses encapsulated search. If I understand
> correctly, this prevents default rules from being used when the arguments
> contain logic variables (which are not bound on other threads), which
> explains why default rules did not work for my intended application. It
> seems that it would be straightforward to change the implementation to use
> booleans instead of failure, which would not have this problem.

This is only partially true. The use of encapsulated search means
that it depends on the implementation of encapsulated search whether
you can use logic variables in arguments. PAKCS suspends in this case,
as you remarked (which means that the implementation of encapsulated
search in PAKCS is more restricted). However, KiCS2 does not suspend
but instantiates logic variables as demanded to proceed the computation.

For instance, consider the zip operation defined with default rules:

    zipd (x:xs) (y:ys) = (x,y) : zipd xs ys
    zipd'default _ _ = []

Then KiCS2 can evaluate zipd with logic variables as arguments:

    kics2> zipd xs [1] where xs free
    {xs = []} []
    {xs = [x]} [(x,1)]
    {xs = (x:y:zs)} [(x,1)]

Therefore, we argued in our paper about default rules that
default rules in Curry are more powerful than default rules
in functional programming or the use of "cut" in logic programming.

Best regards,

Michael

_______________________________________________
curry mailing list
curry_at_lists.rwth-aachen.de
https://mailman.rwth-aachen.de/mailman/listinfo/curry
Received on So Apr 02 2017 - 13:13:56 CEST

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:12 CET