[REBOL] Re: Core 2.5.5 Beta Versions
From: lmecir:mbox:vol:cz at: 25-Feb-2003 14:13
Hi all,
Gabriele wrote:
> Of course, we can define series differently as an infinite space
> where you can place values; if they are infinite, you can move
> forward and backward as you wish, even if the series is empty. But
> the current concept of series is a finite sequence of values.
As I see it, there is no comprehensive description, what is a series. The description:
{A series is a set of values organized in a specific order.} looks correct (Does it admit,
that it is possible to have a series containing one value thrice?) Nevertheless, it looks
to me, that the documentation describes
colors: [red green blue]
as a series, while it didn't admit in the text immediately following it, that
colors2: next colors
was a series too.
The alternative to use the series implementation as its description is most probably
wrong. E.g. the object-oriented programming is appreciated for "implementation details
hiding".
We can refer to the documentation:
{Series data types can all be accessed and processed in the same way with the same small
set of functions.}
, which looks to me as an important part of the series description. What do we get, if
we "consult" the interface?
a) the PICK - influenced series description:
a1) a Rebol series is a mapping, that maps an integer (or logic) INDEX to a Rebol value.
a2) exceptions to the above rule are series, that don't map anything to anything, instead
they fire an error when used with PICK. Let's call these "out of range" series as opposed
to the "in range series" described above.
a3) every "in range series" maps ZERO to NONE
a3) For every series there is a LENGTH? value, such that every integer INDEX larger than
the LENGTH? is mapped to NONE.
a4) For every series there is an INDEX? value, such that every INDEX smaller than 1 -
INDEX? is mapped to NONE
It is interesting, that PICK is unable to discern
a: [1 none]
and
b: [1]
, which may or may not be necessary. Let's describe the NEXT function:
a5) If the NEXT function obtains an "out of range series", it fires an error
a6) If the NEXT function obtains an "in range" series, which has got LENGTH? equal to
ZERO, it returns the series it obtained
a7.1) If the NEXT function obtains an "in range" series, which has got LENGTH? greater
than ZERO, it returns a series with LENGTH?, that is smaller by one, than the LENGTH?
of the original series and with INDEX? greater by one, than the INDEX? of the original
series.
- the new series maps every positive INDEX to the value, to which the original series
maps INDEX + 1.
- the new series maps -1 to the value, to which the original value mapped 1
- the new series maps every INDEX smaller than -1 to the value, to which the original
mapped INDEX + 1
(...)
Isn't this boring? (It is, AFAIAC).
Other possible alternatives are FIRST SKIP influenced descriptions, which are less complicated
(try to formulate some rules), but the out/in range
distinction still messes things unnecessarily sometimes (IMO).
Regards
-L