Re: curry on windows (was: encapsulated search)

From: Claus Reinke <claus.reinke_at_talk21.com>
Date: Thu, 10 May 2007 10:15:42 +0100

> Since partial applications are considered as constructor terms
> so that the normal form of it requires the evaluation of the
> arguments.
 
ah, that will take some getting used to. coming to flp from the pure
functional camp rather than the logic meta-programming camp, the
very idea of partial applications as 'constructor terms' sounds odd,
and ever so slightly dangerous:-)

i find it confusing that evaluation of a subterm is not equivalent to
evaluating that subterm in context:

    -- wrap g f = f g
    Encap> wrap (error "oops")
    {ERROR: oops}

    Encap> wrap (error "oops") (const 1)
    Result: 1 ? ;
    No more solutions.

assuming standard (normal-order) definitions of normal form (nf),
head nf (hnf), weak hnf (whnf), the typical reduction to whnf
reduces less than it could, but any reduction beyond hnf, towards
full nf, implies reductions that might not be needed in context.
what is the rationale for this unusual choice?

btw, pakcs doesn't target normal forms consistently:

    -- testA1 = \x->x (error "oops")
    -- testA2 = wrap (error "oops")
    -- testA3 = let g = (error "oops") in \x->x g

    Encap> testA1
    Result: Encap.testA1._#lambda6 ? ;
    No more solutions.
    Encap> testA2
    {ERROR: oops}
    Encap> testA3
    {ERROR: oops}

'testA1' is in whnf and in hnf, but has no full nf, yet it isn't reduced
any further, avoiding the error.

'testA2' has whnf and hnf, but no full nf, but this version is evaluated
to normal form, leading to an error.

'testA3' might be seen as the cbn hnf of 'testA2' (differing from the
normal order hnf 'testA1' by the shareable binding of 'g'), yet here
we suddenly see reduction under lambdas (for otherwise, there'd
be no demand for evaluation of 'g'), leading to an error.

    Encap> testA2 (const 1)
    Result: 1 ? ;
    No more solutions.
    Encap> testA3 (const 1)
    Result: 1 ? ;
    No more solutions.

in 'testA2 (const 1)' and 'testA3 (const 1), the very same 'testA2'
and 'testA3' are not reduced to nf, but only to hnf, avoiding the
errors.

claus


_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Mai 10 2007 - 11:21:27 CEST

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