>> https://github.com/fricas/fricas/pull/85
> Looks OK, please commit
In order to have a short account of our discussion, I would like to put
also the following into our repository.
At the moment, I think that src/input/eltuniseg.input would be a good
place, because putting it into the ++ docstrings somehow spreads it too
much for my taste and the implementation is anyway according to what is
said in Eltable and the testsuite is a clarification of what is actually
meant for "indices" that are segments.
Other ideas?
Ralf
======================================================================
-- The discussion and design decisions concerning the implementation
-- of x(u) for an open or closed segment u and a list, vector or stream x
-- started with the following tread at the fricas-devel mailing list.
-- https://groups.google.com/g/fricas-devel/c/kNnvUTqxE7A
-- https://www.mail-archive.com/[email protected]/msg14540.html
-- They are encoded in this testsuite (together with eltunisegtests.input).
-- The short version is:
-- * x(a..b by c) gives the same as [x(i) for i in a..b by c] where
-- the square brackets are here an abbreviation for constructing an
-- element of the same type as x.
-- * c=0 always leads to an immediate error.
-- * If b is missing and c<0, then we assume b=minIndex(x).
-- * If b is missing and c>0, then we assume b=maxIndex(x) where
-- (if x is a stream) maxindex(x) should be interpreted as
-- the last index, if x is a finite stream, or
-- infinity, if x is an infinite stream.
-- * If the segment has no element, an empty structure is returned.
-- * "index out of range" errors occur immediately for "eager" structures
-- like List or Vector, etc. that is, if x=[1,2], then x(1..0 by -1)
-- gives an error.
-- For lazy structures like Stream, errors are postponed until an
-- index of x that does not exist is actually accessed. In particular,
-- if x is the stream [1,2], then z:=x(1..0 by -1) is OK. z(1) and
-- rest(z) are also OK. z(2) and empty?(rest z) give an error.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/31e04cf7-322f-9776-99d2-f63cc89cd9f6%40hemmecke.org.