[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [goops] adding a number class with generic methods
From: |
Marco Maggi |
Subject: |
Re: [goops] adding a number class with generic methods |
Date: |
Thu, 4 May 2006 21:13:15 +0200 |
"Neil Jerram" wrote:
>"Marco Maggi" <address@hidden> writes:
> "address@hidden" wrote:
>> I do not understand why the first solution does not work;
>>I've tried different combinations of functions but there is
>>something I am missing.
>
> Damn... it seems to work if I do not EXPORT the generic
> methods.
>
>You mean if you remove the "(export =)" line?
Yes, with the following and no EXPORT invocation
it works.
(define-macro (make-comparison-operator class name func)
`(begin
(define-method (,name (a ,class) (b ,class))
(,func (slot-ref a 'n) (slot-ref b 'n)))
(define-method (,name (a ,class) (b <real>))
(,func (slot-ref a 'n) (usable->mpfr b)))
(define-method (,name (a <real>) (b ,class))
(,func (usable->mpfr a) (slot-ref b 'n)))))
(make-comparison-operator <mpfr> = mpfr-equal?)
--
Marco Maggi
- [goops] adding a number class with generic methods, Marco Maggi, 2006/05/02
- Re: [goops] adding a number class with generic methods, Marco Maggi, 2006/05/03
- Re: [goops] adding a number class with generic methods,
Marco Maggi <=
- Re: [goops] adding a number class with generic methods, Mikael Djurfeldt, 2006/05/04
- Re: [goops] adding a number class with generic methods, Neil Jerram, 2006/05/06
- Re: [goops] adding a number class with generic methods, Mikael Djurfeldt, 2006/05/07
- Re: [goops] adding a number class with generic methods, Neil Jerram, 2006/05/07
- Re: [goops] adding a number class with generic methods, Ludovic Courtès, 2006/05/09
- Re: [goops] adding a number class with generic methods, Mikael Djurfeldt, 2006/05/09
- GOOPS and Code Complexity, Ludovic Courtès, 2006/05/09