[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] update: complex egg, problems with SRFI-10 implement
Re: [Chicken-users] update: complex egg, problems with SRFI-10 implementation
Wed, 13 Oct 2004 20:12:00 +0200
Mozilla Thunderbird 0.8 (X11/20040918)
Felix Winkelmann wrote:
i have a few questions about the complex egg.
first, wouldn't it be slightly more efficient to represent a complex
number as a length 2 vector?
secondly, don't we need some sort of type identifier to distinguish a
complex number from a pair, or a length 2 vector?
i'm thinking of something like ('complex . (a . b)) or ('complex . #(a
Actually a seperate data type would be best (could just be a custom
record type with an accompanying printer).
If you think that would be best, why shouldn't I do it this way ;) A new
version using a SRFI-9 record type instead of conses is available from
the usual location.
I also defined a SRFI-10 reader constructor to go along with the record
printer and ran into the following problem:
Suppose you do this in csi:
#;4> (define-record blubb a b)
#;5> (define-reader-ctor 'blubb make-blubb)
#;6> #,(blubb 1 2)
Error: illegal non-atomic object: #<blubb>
yields an error -- but why?
This works, of course:
#;6> (make-blubb 1 2)
Any ideas where this strange behaviour comes from?