HaloO,

Xavier Noria wrote:
IMO to include something related to infinity you need to stick with
some particular model and forget the rest.

Well spoken. But I think that the model John has chosen is a bit
too restrictive. If a type has a notion of Zero it could have a
similar notion of infinity just at "the other side". For the Int
type in a two's complement mindset that means that counting through
the Ints in increasing order from zero is the same as going in
the *same* direction from -Inf where Zero is the unreachable infinity.
Here I assume that both Zero and -Inf are represented as the infinite
string of 0 binary digits. One is little endian the other big endian,
though. If you don't know where you are in your infinite sequence of
0 then Zero is indistinguishable from -Inf and -1 is indistinguishable
from +Inf, both are infinite sequences of 1.

E.g. +('9' x Inf) == -1 could be a true comparison that doesn't
even scratch the memory resources of temporary hardware. With the
above in mind we could e.g. also define ^-4 === -4..-1 most
conveniently as (*-4)..(*-1) for array indexing from the back in
forward order. Or perhaps that is ^(*-4) and the ^-4 is for indexing
in front of the array. The Whatever type is also behaving a bit like
Inf because it represents different numbers in different arrays.
That is

   my Whatever of Int $idx = -4;

always indexes arrays from the back but behaves like normal -4 when
no special handling is required, IOW it sets the shift to zero. Note
that infix:<op>:(Whatever[::X],X-->Whatever[X]) but infix:<op>:(::X,
Whatever[X]-->X) are sort of non-commutative. Note that the default
value for Whatever is Inf ;)


Regards, TSa.
--

"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to