On 04/26/2017 08:00 PM, Waldek Hebisch wrote:
> oldk1331 wrote:
>>
>> It will be a big change so it will get into next release
>> if this idea get approved.  Before that, I'd like some
>> comments first.
>>
>> There are data structure categories that explicitly supports
>> cyclic data structure, namely UnaryRecursiveAggregate.
>>
>> That means the domains from this category will have
>> to support cyclic data structure.  But for List, the most
>> basic data structure, for performance reasons, doesn't
>> support cyclic well.  And it's possible to have a data structure
>> that it's recursive but not cyclic.
>>
>> So it's reasonable to split cyclic-related functions into
>> its own category, and make domains non-cyclic by defalut.
>> And implement new domains that support cyclic data
>> structure properly.
>>
>> Comments?

I'm somewhat in favour of having the domain List(T) only representing
non-cyclic lists and PossiblyCyclicList(T) to represent lists that can
possibly have cycles.

To me this is somewhat on the same level like the difference between a
tree and a DAG.

> I do not think making List non-cyclic is feasible.  Namely
> once you allow in-place modification you can create
> cyclic structures.

That is true, but a proper specification should forbid the user to
create such structure by danger of running in to endless (undetected)
loops. I don't think that disallowing setRest! in non-cyclic List is a
good idea. So yes, non-cyclic lists cannot be sensibly be enforced by
code, but I still think that a domain of non-cyclic lists sounds like a
good and clean idea.

> Consider for example Streams: they use possibly cyclic
> lists as representation.  Having two separate functions
> which create streams from lists (one from cyclic, the
> other from non-cyclic list) looks clumsy.

There could be

construct: PossiblyCyclicList(T) -> %
construct: List(T) -> %

in the exports of Stream(T), so the user wouldn't see any difference.

Just my 2 cents.

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to