On Sun, Dec 01, 2002 at 05:19:29AM +0900, MikkelFJ wrote:
> In algebra, the one element is a particularly important element (along with
> zero) because you can generate all values by systematically adding the one
> element to the previous result, starting with the zero element.
Actually, I believe the "one element" is defined as the neutral element of
the multiplication operation. Actually, at least for fields only the prime
fields are generated using only one (and maybe zero). Even GF(4) cannot be
constructed by using only 1 (because trying so would lead to GF(2) = Z2, the
prime field of GF(4))

> In fact this is exactly the same as the next and next! methods, thus we just
> need the interpreter to go along with these synonyms. Note that integers do
> not have a next! operation and float do not have a next method at all - this
> makes perfect sense:
> 
> In algebraic terms, there is no 'one' element for Real numbers, while
> natural numbers (integers) do have a one element. Furthermore it is not
> within the realms of Ruby to redefine the natural numbers, thus no next!
> method.
As I said above, "one" is defined as the element which satisfies a*1=a for
all a. This "generator" property of the "one element" is better expressed as
the generator property of a sucessor() function. E.g, every positive integer
can be expressed as succ(succ(succ(succ(....succ(1)...)))).
It makes perfect sense for me to define succ and succ! for integers,
but not for reals. But x++ really just defined as x=x+1, and thus makes
sense for integer _and_ float.

> The ++ operator is really a 'generator' in algebraic terms. It should
> generate the next element in the set of all elements of a given type, such
> as the natural numbers. When a one element is defined, the generator is the
> add one operator - it is not necessarily the only generator, but it works.
No, ++ is _not_ a generator. succ or next is, and this is more consistent
with mathematics than making ++ a generator for N.

greetings, Florian Pflug