>Jim Callahan says:
>
>>    It seems that there is no way to update even the smallest part of the
>>    data-structure without having to traverse the entire thing.  This
>>seems to be
>>    an inherent property of purely functional languages.  This might not be a
>>    big deal with linked lists but consider something much larger and
>>mode complex
>>    like a cyclic graph, etc...
>>    ...
>>    Am I missing something fundamental here?  I sure hope so...
>
>No, you're not missing anything.  That's how it is.
>
.....
>On the other hand, for other applications, the purely functional style
>may be considered better-- it admits more parallelism.  For example,
>suppose you had a concurrent process that is still working on the old
....

Really, the whole point is that pure, lazy FP forces a completely different
sort of approach to the design of data structures. While it often seems as
if efficiency cannot reasonably be achieved, the fact is that laziness
ensures that only the work that _really_ needs to be done (in order to
yield a result--or, more properly, enough of a result) ever gets done.

What might be particularly helpful would be to take a look at Chris
Okasaki's work-in-progress, Edison at
http://foxnet.cs.cmu.edu/~cokasaki/edison/.

In the 'strict' world, the control flow of a program is more or less
specified by the programmer--evaluate the arguments completely, make a
function call, etc.; laziness enables the encapsulation of functionality
within functions--even though the actual control flow is often much more
complex.

As a result, purely functional, lazy data structures can be a little tough
to get one's head around.

--Artie



   Arthur Gold                     Austin, Texas
 ** [EMAIL PROTECTED]  [EMAIL PROTECTED]  **

General recursion is the `go to' of functional programming.
                   --Erik Meijer




Reply via email to