On 07/04/2016 01:31 PM, oldk1331 wrote:
>> Since I didn't have need, I don't even know how to (officially) create a
>> List that has a cycle.
> 
> x := [1,2]
> setrest!(rest x,x)

OK, I was a bit vague with my "official". Of course, I can construct
such a list with setrest!, but using a destructive function for me means
that I can potentially fall out of the domain. A quick glance on the
exports of List didn't show something (non-destructive) that lets me
create a cyclic list. To my relief. Otherwise an element of List(X)
would not be what I think it is. And finiteAggregate would be a lie.

>> A list that repeats 1,2,1,2,... is not finite for my taste even if it
>> can be stored a list with one cycle, so it should not be a List(X).
> 
> List is of category ListAggregate which has FiniteLinearAggregate.
> 
> A cycle list is finite,

Yeah, that's where my problem is. I would count that as infinite even
though I know that internaly there are just finitely many elements stored.

> while [f x for x in 1..] is not.

That's a list? No, it's a Stream. And that is perfectly fine for me.
Lists with a cycle should not live in List(X), but in Stream(X).

> finiteAggregate is pretty much everywhere in aggcat.spad,
> I wonder if there's a better way.

Yes and OK, but define the meaning of finiteAggregate in your own words.
It you come up with something "can be represented by finitely many
objects", then also "[f x for x in 1..]" is finite. There are only
finitely many letters between the quotes.

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