Re: cons and backtracking

Daniel Bonniot <[email protected]> Sat, 02 Apr 2005 15:56:29 +0200
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Hi Steve,

I agree a functional list type would be useful. There are several possibilities:

1) simply extend the current framework with a Cons(T, List<T>) class. This 
allows constant-time consing. Similarly, a Concat(List<T>, List<T>) class 
could be added to provide constant-time concatenation.

2) provide a completely separate hierarchy for functional (unmodifiable) 
lists. The advantage of this solution is that this type (FList ? some more 
descriptive name? Sequence?) could safely be made covariant (a Sequence<int> 
is a subtype of Sequence<long>). Downside, it would not be a collection, 
although we should still be able to make it iterable.

Possibly, both approaches could be useful to have. Bryn might have comments on 
this question as well.


Would you or other people be interested in contributing to such libraries? I'm 
planning to "open up" the libraries: decoupling them more from the core 
compiler, and making it easier to contribute to them and create new ones. If 
the occasion arises, i'll do that in priority.


Daniel



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click