Re: Help using currypp

From: James Koppel <jkoppel_at_mit.edu>
Date: Sun, 2 Apr 2017 17:22:26 -0400

Thanks! Sounds like I should take another stab at getting KiCS2 installed.

On Sun, Apr 2, 2017 at 7:13 AM, Michael Hanus <mh_at_informatik.uni-kiel.de>
wrote:

> 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
>
>

Received on Mo Apr 03 2017 - 09:12:56 CEST

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