[comp.lang.prolog] infinite structures, lazy evaluation

jha@lfcs.ed.ac.uk (Jamie Andrews) (04/14/89)

     I agree with Richard that you can still "prove theorems"
about infinite lazily evaluated data structures, contrary to
what Sanjai has claimed.  The only real problem is defining what
an infinite list is, which is a problem both in the logical and
the functional case.  Colmerauer and others have developed
pretty good semantics for infinite lists, though.

     However, I would agree with Sanjai that it's easier, or
more elegant, to do lazy evaluation in functional languages.
This seems to be because there's only one place where the value
of a variable can flow from -- the evaluation of a function call
-- so it can be delayed in the form of the function call.  With
logic programming, it's not always obvious where the value is
going to come from, which of course is the whole point of LP.

     Without true functions, we have to rely on clause
re-ordering, coroutining, very smart evaluators, and so on to
get the effect of lazy evaluation.  With functional programs,
it can be done fairly neatly.

     Old remarks about programmers' difficulties in following
lazy evaluation still apply, though...

--Jamie.
  jha@lfcs.ed.ac.uk
"Mayan skies sleeptalk with voices of lovers"

johnson@csli.STANFORD.EDU (Mark Johnson) (04/16/89)

Talking about lazy evaluation reminds me of a very interesting
article in New Generation Computing 6, 421-438 by Sato and Tamaki
called "Existential Continuation".

They show how Ueda's continuation passing transformation can be
automatically applied using a _deterministic_ sequence of unfold/fold
transformations, given a set of "mode" declarations.

Mark Johnson

steve@hubcap.clemson.edu ("Steve" Stevenson) (04/17/89)

From article <1770@etive.ed.ac.uk>, by jha@lfcs.ed.ac.uk (Jamie Andrews):

> ....  The only real problem is defining what
> an infinite list is, which is a problem both in the logical and
> the functional case.

I thought Dana Scott had this all worked out.  Ya'll are working too hard.

-- 
Steve (really "D. E.") Stevenson           steve@hubcap.clemson.edu
Department of Computer Science,            (803)656-5880.mabell
Clemson University, Clemson, SC 29634-1906