call-time choice vs partial application?

From: Claus Reinke <claus.reinke_at_talk21.com>
Date: Fri, 04 May 2007 16:39:34 +0100

according to the Curry report (2.3.1), Curry's sharing of arguments corresponds
to call-time choice (if a rule is applied to a function call, a unique value must be
assigned to each argument).

the report does not elaborate, but according to the paper it refers to, choice
happens immediately before reduction, so only for complete applications.

consider these definitions:

    wrap g f = f g

    a = (wrap (x=:=0?x=:=1), x)
      where x free

    b = (\f-> f (x=:=0?x=:=1), x)
      where x free

    main = (a,b)

i would expect a and b to be equivalent, as the evaluation of and choice for
wrap's first parameter shouldn't happen until we have a complete application
and demand for its result ("if a rule is applied to a function call").

here is what the www interface to PAKCS gives:

    Goal: main :: (((Success -> a) -> a,Int),((Success -> b) -> b,Int))
    Result: ((wrap success,0),(currytest4496.b._#lambda1 _2784,_2784)) ?

note how the first parameter in wrap's partial application has been
evaluated, and the variable instantiated. the second tuple component
shows the expected result.

is my expectation wrong, or PAKCS? what do other Curry implementations
return here?

claus


_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on So Mai 06 2007 - 17:55:59 CEST

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