This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: quaternions in the numeric tower


On Nov 12, 2014, at 8:18 PM, Per Bothner <per@bothner.com> wrote:

> On 11/12/2014 03:37 PM, Jamison Hope wrote:
>> Hi Per,
>> 
>> I finally got around to implementing support for quaternions in the
>> numeric tower (it was originally my idea, after all).  Would you be
>> interested in pulling this in before the big version 2.0?
> 
> Cool.  If it's ready in time (which includes writing documentation) then
> it can go in.
> 
> I think the documentation can go in a new @section in @node Numbers.

OK.

>> There are now a handful of new functions in kawa.lib.numbers (jmag-part,
>> kmag-part, colatitude, etc).  Where in Scheme#initScheme should those
>> go?
> 
> Nowhere, IMO.  I think we should require either:
>  (import (kawa quaternions))
> or
>  (require 'quaternions)
> to use these functions.
> 
> Note that implies the new functions should go in kawa/lib/kawa/quaternions.scm,
> not kawa/lib/numbers.scm.

OK, I'll put the new functions there.  But what about <quaternion> as
a type?  That would still go in the LispLanguage type map, right?
In which case at the very least the quaternion? function should get
defined automatically.  It's like complex? and real? in that it should
return #true on both actual instances of <quaternion> as well as the
java.lang number types, so we would get incorrect results if Kawa
decides to do its (TYPE? x) -> (x instanceof TYPE) thing.

Is kawa/lib/numbers.scm permitted to require/import (kawa quaternions)?
Some of its functions now make use of quaternion functions.  For example,
real-valued? is now

(define (real-valued? x) ::boolean
  (and (quaternion? x)
       (zero? (imag-part x))
       (zero? (jmag-part x))
       (zero? (kmag-part x))
       (real? (real-part x))))


--
Jamison Hope
The PTR Group
www.theptrgroup.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]