[Edu-sig] Re: rationals
Dennis E. Hamilton
dennis.hamilton@acm.org
Fri, 11 Oct 2002 13:11:50 -0700
I know this isn't the place for this, but the conversation is a lot of fun.
If I were creating a canonical form for input-output, it would be based
around
<simple-rational> ::= <simple-non-rational-numeral>R |
<simple-non-rational-numeral>r
<rational-numeral> ::= <simple-rational> | <simple-rational> /
<simple-non-rational-numeral>
where the "/..." part is optional and one might even relax the denominator
<simple-non-rational-numeral> constraint in an input stream.
Note that 1.5e-3r/17
would be a valid input, but the canonical output of its value is more likely
to be "3r/34000".
In expressions, the "/" would just be a "/" and everything works as expected
for "/".
-- orcmid
------------------
Dennis E. Hamilton
http://NuovoDoc.com/
mailto:dennis.hamilton@acm.org
tel. +1-206-932-6970
cell +1-206-779-9430
The Miser Project: http://miser-theory.info/
AIIM DMware: http://DMware.info/
-----Original Message-----
From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On
Behalf Of Kirby Urner
Sent: Friday, October 11, 2002 11:24
To: Christopher A. Craig
Cc: edu-sig@python.org
Subject: Re: [Edu-sig] Re: rationals
[ ... ]
I like J's economy, but I can see 1/2r as a very viable alternative.
As you say, it has much in common with 1+2j, where you need both
+ and j (two symbols) to signify complex.
An argument for 1r2 is that 1e2 sets a precedent. But 1j2 is not
legal in Python, as it is in J, so the consistency is shakier
(not as *much* precedent).
Another point:
With longs, I can use either upper or lower case l, which isn't
so readable in code, as lowercase l looks like 1. But r and R
are clearly not numbers. So I assume the following would likewise
be legal:
>>> 1/2R
(1/2)r
or maybe that's 1/2r -- not sure which.
Kirby
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig