One-to-one (aka injective) means that F(s) = F(s') only happens if s=s'. In other words no more than one value will map to a given target.
Onto (aka surjective) means that for each t in the target space T there is an s such that F(s)=t.
The necessity that F(s) not have 2 values (which you gave as a definition of being one-to-one) is required for F to be a function. The requirement of "exactly one" that you stated for onto is wrong.
Furthermore any function F that is one-to-one has a unique local inverse function G from its image in T back to S such that G(F(s)) is s for all s in S. For G to truly be the inverse of F, you also need F(G(t)) to be t for all t in T, which requires that F be onto.
Therefore any function which is one-to-one and onto is called invertible (because it has an inverse function).
And the entire discussion about strings comes down to this. The ++ operation is not onto the set of alphanumeric strings, and therefore does not have an inverse from the set of all strings. Therefore there is no natural way to define a general -- operator for strings, so none has been defined.
(Exercise for the interested reader - search the archives of p5p for past discussions of the -- operator on strings. I know that it has been discussed extensively there, and am just too lazy to search for it.)
In reply to Re: Re: $a++ allowed by $a-- is not ! why?
by tilly
in thread $a++ allowed by $a-- is not ! why?
by abhishes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |