|
Re: New Cat Release and Documentation
|
Posted: Jun 21, 2006 8:53 AM
|
|
> > Because everything is purely functional in Cat this > means > > that any list or data structure in Cat has to maintain I have a few observations: > - In a case like the one you proposed, no part of the > program ever uses the unreduced list. A smart compiler > could destroty the original list without changing the > program semantics OK, how about this ;-)
[bigprogram] dup ! => [bigprogram] [bigprogram] => [bigprogram] bigprogram
Surely the quoted [bigprogram] should not be destroyed by the reduced program.
> - Copying semantics aren't so bad as all that. e.g. C++ > programs often run fine
What about the efficient concatenation of big lists A and B (or programs)?Surely you this operation to be fast to, say O(log(size(A) + size(B)) and not O(size(A + B)).
> - A sequence of consecutive numbers would be better > represented using: > > def myseq = 1 1000000 init; > > which can be easily stored as a generator function > internally. Yes, it would be a lazy list ;-)
> > As an interesting node: I have a list class in C# under > development which switches between different internal > representations based on usage. For example, in some > circumstances it uses an array representation, in others a > linked list, and in others still it uses a generator > function. Cool.
> > Finally, I should ask, are there better alternatives I am > not aware of? I am definitely open to suggestions. May be you should look at Chris Okasaki's work on purely functional datastructures. The most recent development is: Finger Trees by Ralf Hinze. I also use Treaps sometimes for fast list implementations.
|
|