Re: Smap: Collecting small programs

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Thu, 30 Oct 2014 17:58:54 +0100

Hi David,

this is only a partial answer to all the issues you pointed out.

You wrote:
> 2. The operator precedences don’t have enough granularity - I wanted a
> precedence of 4.5 for difference lists

I agree, but this is inherited from Haskell. At some early point we
decided for compatibility with Haskell instead of creating a new
syntax.

> 3/4. There are issues relating to free variables and unification models
> that prevent translation from Prolog.
> ...

In principle, any *logic program* can be translated to Curry
in a straightforward manner. However, for Prolog with all its
non-logic features, it is different.

> Even adding in ensureNotFree doesn’t help as all disjunctions can suspend…
> I do have a working (sicstus/swipl) Prolog version of this!

Just a comment: ensureNotFree only suspends computations but can't
be used as a case distinction. Hence, you can't do a case distinction
on difference lists (similar to logic programming) so that difference
lists should only be used for producing results. For instance,
the reverse operation takes a standard list and produces a difference
list:

revD :: [a] -> DList a
revD [] = (m#m) where m free
revD (x:xs) = appD (revD xs) (x:m # m) where m free

with difference list concatenation defined by

appD (a#b) (b#n) = (a#n)

In a similar way, you can also define quicksort with difference lists.
I added these examples, of course, to Smap:

http://www-ps.informatik.uni-kiel.de/smap/smap.cgi?27

Best regards,

Michael
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Okt 30 2014 - 17:59:58 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:13 CEST