Re: generic * and 0

2006-12-07 Thread Mikael Djurfeldt
2006/12/6, Marius Vollmer [EMAIL PROTECTED]: Kevin Ryde [EMAIL PROTECTED] writes: The only case I can think of where a common zero may not be good is with matrices, where (* 0 matrix) = matrix could preserve the dimensions of the input matrix in the output matrix. I would have to dig for

Re: generic * and 0

2006-12-05 Thread Mikael Djurfeldt
2006/12/5, SZAVAI Gyula [EMAIL PROTECTED]: Kevin Ryde wrote: Mikael Djurfeldt [EMAIL PROTECTED] writes: (Not entirely sure that the common zero is a good idea, but I tend to think so.) I suppose it's a question of whether * should do that, or leave it up to the application. I think

Re: generic * and 0

2006-12-04 Thread Mikael Djurfeldt
2006/12/4, Kevin Ryde [EMAIL PROTECTED]: While nosing around nearby stuff I noticed (* 0 1.0) = 0 (* 0 1+1i) = 0 but (* 1.0 0) = 0.0 (* 1+1i 0) = 0.0 which seems a bit inconsistent. Indeed. R5RS Exactness reads like either exact or inexact is permitted,

Re: generic * and 0

2006-12-04 Thread Kevin Ryde
Mikael Djurfeldt [EMAIL PROTECTED] writes: Good idea. I made the change. Because of paragraph 6.2.2, a program cannot expect to get the result 0.0, and it seems like a strength of the implementation to provide the additional piece of information that the result is indeed *exactly* 0. If

Re: generic * and 0

2006-12-03 Thread Kevin Ryde
While nosing around nearby stuff I noticed (* 0 1.0) = 0 (* 0 1+1i) = 0 but (* 1.0 0) = 0.0 (* 1+1i 0) = 0.0 which seems a bit inconsistent. R5RS Exactness reads like either exact or inexact is permitted, but I imagine it ought to be the same whichever way

Re: generic * and 0

2006-12-01 Thread Kevin Ryde
SZAVAI Gyula [EMAIL PROTECTED] writes: (use-modules (oop goops)) (define-class c ()) (define-method (* a (b c)) #t) (* 0 (make c)) == 0 Thanks, that's a bug. - switch (xx) - { -case 0: return x; break; -case 1: return y; break; - } - Though that's

Re: generic * and 0

2006-12-01 Thread Mikael Djurfeldt
2006/12/1, Kevin Ryde [EMAIL PROTECTED]: SZAVAI Gyula [EMAIL PROTECTED] writes: (use-modules (oop goops)) (define-class c ()) (define-method (* a (b c)) #t) (* 0 (make c)) == 0 Thanks, that's a bug. Are you sure? If you want to use an operator which is common for numbers and c:s, why

Re: generic * and 0

2006-12-01 Thread Kevin Ryde
Mikael Djurfeldt [EMAIL PROTECTED] writes: If you want to use an operator which is common for numbers and c:s, why don't you want to use a common zero? If you don't, the behavior of the operator will be inconsistent. For multiply by 0, I can sort of think of cases when the return type

generic * and 0

2006-11-29 Thread SZAVAI Gyula
guile-1.8-20061126 (use-modules (oop goops)) (define-class c ()) (define-method (* a (b c)) #t) (* 0 (make c)) == 0 --- orig/libguile/numbers.c 2006-11-29 18:09:22.393764800 +0100 +++ mod/libguile/numbers.c 2006-11-29 18:10:22.319934400 +0100 @@ -4416,12 +4416,6 @@ intbig: