[#6143] — Christophe Poucet <christophe.poucet@...>

Hello,

17 messages 2005/10/04
[#6147] Re: patch.tgz — nobu.nokada@... 2005/10/04

Hi,

[#6199] Kernel rdoc HTML file not being created when rdoc is run on 1.8.3 — James Britt <ruby@...>

When 1.8.3 came out, I grabbed the source and ran rdoc on it. After

9 messages 2005/10/08

[#6251] RubyGems, upstream releases and idempotence of packaging — Mauricio Fern疣dez <mfp@...>

[sorry for the very late reply; I left this message in +postponed and forgot

14 messages 2005/10/12

[#6282] Wilderness: Need Code to invoke ELTS_SHARED response — "Charles E. Thornton" <ruby-core@...>

Testing the My Object Dump and I am trying to cause creation

13 messages 2005/10/14
[#6283] Re: Wilderness: Need Code to invoke ELTS_SHARED response — Mauricio Fern疣dez <mfp@...> 2005/10/14

On Fri, Oct 14, 2005 at 05:04:59PM +0900, Charles E. Thornton wrote:

[#6288] Re: Wilderness: Need Code to invoke ELTS_SHARED response — "Charles E. Thornton" <ruby-core@...> 2005/10/14

Mauricio Fern疣dez wrote:

[#6365] Time for built-in Rational and Complex classes? — Gavin Sinclair <gsinclair@...>

There has been some support for, but no comment on, RCR #260 ("Make

12 messages 2005/10/24
[#6366] Re: Time for built-in Rational and Complex classes? — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/24

On Mon, 24 Oct 2005, Gavin Sinclair wrote:

[#6405] Re: [PATCH] Pathname.exists?() — "Berger, Daniel" <Daniel.Berger@...>

12 messages 2005/10/25
[#6406] Re: [PATCH] Pathname.exists?() — TRANS <transfire@...> 2005/10/25

On 10/25/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

[#6408] Re: [PATCH] Pathname.exists?() — Gavin Sinclair <gsinclair@...> 2005/10/25

On 10/26/05, TRANS <transfire@gmail.com> wrote:

[#6442] Wilderness: I Have formatted README.EXT into an HTML Document — "Charles E. Thornton" <ruby-core@...>

I have taken README.EXT (English Version Only) and have reformatted

14 messages 2005/10/27

[#6469] csv.rb a start on refactoring. — Hugh Sasse <hgs@...>

For a database application I found using CSV to be rather slow.

50 messages 2005/10/28
[#6470] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/28

[#6471] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/28

On Oct 28, 2005, at 8:53 AM, Ara.T.Howard wrote:

[#6474] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/28

On Fri, 28 Oct 2005, James Edward Gray II wrote:

[#6484] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 9:58 AM, Ara.T.Howard wrote:

[#6485] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sat, 29 Oct 2005, James Edward Gray II wrote:

[#6486] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 8:25 PM, Ara.T.Howard wrote:

[#6487] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sat, 29 Oct 2005, James Edward Gray II wrote:

[#6491] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 8:43 PM, Ara.T.Howard wrote:

[#6493] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 10:06 PM, James Edward Gray II wrote:

[#6496] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sun, 30 Oct 2005, James Edward Gray II wrote:

[#6502] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/30

On Oct 29, 2005, at 12:11 PM, Ara.T.Howard wrote:

[#6505] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/30

On Mon, 31 Oct 2005, James Edward Gray II wrote:

[#6511] Planning FasterCSV (was Re: csv.rb a start on refactoring.) — James Edward Gray II <james@...> 2005/10/30

I've decided to create a FasterCSV library, based on the code we

[#6516] Re: Planning FasterCSV (was Re: csv.rb a start on refactoring.) — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/31

On Mon, 31 Oct 2005, James Edward Gray II wrote:

[#6518] Re: Planning FasterCSV (was Re: csv.rb a start on refactoring.) — "NAKAMURA, Hiroshi" <nakahiro@...> 2005/10/31

-----BEGIN PGP SIGNED MESSAGE-----

Re: Integer#** weirdness

From: Peter Vanbroekhoven <calamitates@...>
Date: 2005-10-18 16:08:14 UTC
List: ruby-core #6323
On Tue, 18 Oct 2005, Mathieu Bouchard wrote:

> What should happen after coercion? if i do 2**aMatrix, is it required that
> the left side gets promoted to a matrix (that is, the same type as the
> right-handed argument) ? Then is there any definition of matrix**matrix ?
> (i haven't ever used one). It would have to extend the semantics of
> scalar**matrix. Maybe I'm just lost too...
>
> But then, x**y = exp(log(x)*y), and since both exp and log are defined on
> matrices (through use of singular value decomposition), this gives us a
> natural definition for aMatrix**anotherMatrix.

I suppose it's only defined for square matrices. And indeed, through power 
series, about any analytic function can be defined on square matrices (for 
which the power series converges, of course).

But that's besides the point (of my problem), point is that Ruby as it is 
now precludes these kinds of things by doing the comparison before the 
coercion in some cases. This means that if I wanted to add matrix 
exponentials to Ruby, I'd need to redefine Integer#** instead of hooking 
into Ruby's coercion framework.

OTOH, coercion is indeed not always an option. Say I just wanted to define 
someInteger**someMatrix, then I've got only one option in Ruby's coercion 
framework, namely to coerce the integer to a matrix. And although it is 
possible to define someMatrix**someOtherMatrix, I may not want to go 
through all that trouble, even when someMatrix is just a 1x1 matrix in 
this case because it is overhead to build the matrix for nothing.

> The complex fields (like Q(sqrt(-1)) and C) are not in any way totally
> orderable. If you quotient the field in some way then you may obtain
> something totally orderable or not, but the best you can get with an
> ordinary complex field is a partial order. However Ruby doesn't have a
> Semicomparable interface (the name i wanted to give to partial ordering in
> Ruby), despite the Module class already supporting most of it in an
> implicit way: think about the meaning of "A<B" as "A is subclass of B" aka
> "A objects are a subset of B objects".
> 
> What do you think of this?

C can be totally ordered, for instance lexical order (with i = sqrt(-1)):

   a + b * i <= c + d * i   iff   a < c  or  a = c and b <= d

Is that a useable order? Well, that depends on what you need that order 
for. There are other orders possible though, but Ruby has only support for 
a single order. I wonder how hard it would be to have Ruby support 
multiple orders for the same kind of object. Given that we can use 
different < symbols, it would probably look like this:

   Complex.with_ordering(Complex::LexicalOrder) do
     Complex(1, 1) < Complex(1, 2) #=> true
   end

IMO though, we don't need a separate Semicomparable interface. #<=> 
already returns nil when two objects are not comparable. For instance
1 <=> true gives nil. Currently the comparison methods in Comparable raise 
an error when #<=> returns nil, but this could be changed to have these 
methods return false instead. Or nil, as Module#< does when two classes 
are not comparable, which would make things more consistent.

Peter

In This Thread