Re: Help using currypp

From: Michael Hanus <>
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,


curry mailing list
Received on So Apr 02 2017 - 13:13:56 CEST

This archive was generated by hypermail 2.3.0 : Sa Dez 09 2023 - 07:15:14 CET