[Cuis-dev] Some un-accurate information on The Cuis Book

Luciano Notarfrancesco luchiano at gmail.com
Mon Feb 27 03:09:03 PST 2023


Hi Ken,
I don’t have a strong opinion about Complex and I’m cool with either
option, specially because it’s not in the base image and because I don’t
really use the package. But for this kind of situation I tried both
approaches (reducing them or not), and in general I decided to not reduce
them. One of the reasons is that if you reduce them then you might end up
with a Number instead of an instance of Complex, and for it to be
consistent you’d have to implement the Complex protocol in Number, or you
might get a MNU. In fact I ended up implementing my own “fractions” (that I
call Rational) and they don’t reduce to integers. Another reason for doing
it like this with fractions and other “numbers” is to avoid ambiguities,
for example I have the message isUnit that returns true if the element has
an inverse, and for example the rational number 2/1 is a unit (the inverse
is 1/2) but the integer 2 is not a unit.

Cheers,
Luciano

On Sun, 26 Feb 2023 at 20:48 ken.dickey--- via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> On 2023-02-26 05:31, ken.dickey--- via Cuis-dev wrote:
>
> > BTW, we can do better.  I think -4+0i above should be and print as -4.
>
> Ah! The code is already there and just needed to be uncommented
> (attached).
>
> As we have Complex>>basicReal:imaginary: why does
> Complex>>real:imaginary not do the simplification?  Can we not just
> enable this?
>
> Thanks,
> -KenD
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230227/155612ec/attachment.htm>


More information about the Cuis-dev mailing list