Re: Curry Report Vers. 0.8.2

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Fri, 24 Mar 2006 16:09:23 +0100

Am 24.03.2006 um 12:29 schrieb Bernd Brassel:

> Michael Hanus wrote:
>> I think it would be interesting to see your definition of (=:=)
>> in terms of ($!!), since (=:=) does not always compute the normal
>> form of both arguments (e.g., if one argument has no value).
>
> I didn't. Just by USING ($!!) in one case as described.
>
>> Why do you think it is "hopelessly inefficient"? Any conrete
>> numbers from your implementation? I did this optimization you
>> mentioned and it was an improvement of around 30% compared
>> to the description of the Curry report. So, from my experience,
>> I cannot say that this approach is "hopelessly inefficient".
>
> Considering that binding of free variables is by far the most
> expensive
> operation in the Haskell implementation, it would be surprising if it
> was anything near your 30%. In Prolog free variables should be quite a
> bit cheaper, I would assume, or don't you think?

If binding a variable is so inefficient in your implementation,
what about using x=:=x in order to compute a normal form?

Incidentally, your statement that for x=:=e it is sufficient to
compute the normal form of e is not correct. You also have to
perform an occurs check (see Sect D.4 of the report) in order to
ensure that the unified terms remain finite. Thus, the expression
   let x free x =:= Just x
should fail in a correct implementation.

Interestingly, implementing the occurs check in MCC (upon Michael's
request) not only improved MCC's conformance with the report, but
also helped to improved performance. While checking for an occurrence
of x in e you get the information whether e is already in normal form
for free. If that is the case, you can bind x directly to e without
further evaluation. Obviously, this is particularly interesting for
programs employing a logic programming style, where results are
returned through an auxiliary variable.

Regards
Wolfgang



_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Sa Mär 25 2006 - 17:45:16 CET

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