Hi Marek!
I would def a protocol CustomArithmetics and include the the nescessary
methods for arithmetics, and then a deftype for each custom arithmetics. It
would be possible to extend the protocol for Longs and Integers as well, if
needed.
If you would like to use the normal operator-names +,-
Marek Kubica ma...@xivilization.net writes:
I am idly thinging on how to create types with special restraints on
them, like being only in the range 1-1000 or only even numbers etc and
all normal operations like + and - still being valid.
+ and - would have wrap-around semantics, I guess?
Hi,
Wow, thanks for all that input :) It is always a pleasure to post on
this list, to get such good advice.
On Wed, 21 Dec 2011 09:51:31 +0100
Tassilo Horn tass...@member.fsf.org wrote:
I am idly thinging on how to create types with special restraints on
them, like being only in the range
2011/12/21 Marek Kubica ma...@xivilization.net
Hi,
Thanks for your mail, glad to get ideas so fast :)
On Wed, 21 Dec 2011 09:51:04 +0100
Linus Ericsson oscarlinuserics...@gmail.com wrote:
I would def a protocol CustomArithmetics and include the the
nescessary methods for arithmetics,
Marek Kubica ma...@xivilization.net writes:
Hi Marek,
Yeah, the problem that I see is that I have an additional set of
operators, r+, r- and friends, so every consumer has to be aware of my
numbers and use the proper operations, like the float-operators in
OCaml +. -. or the BigInteger stuff
Hi,
I am idly thinging on how to create types with special restraints on
them, like being only in the range 1-1000 or only even numbers etc and
all normal operations like + and - still being valid.
Anyone has an idea how to implement that? In Python I'd subclass the
number type and implement all