|
From: | Thomas Chust |
Subject: | Re: [Chicken-users] update: complex egg, problems with SRFI-10 implementation |
Date: | Wed, 13 Oct 2004 20:12:00 +0200 |
User-agent: | Mozilla Thunderbird 0.8 (X11/20040918) |
Felix Winkelmann wrote:
TiM wrote:greetings programs. 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 b)).Actually a seperate data type would be best (could just be a custom record type with an accompanying printer). [...]
Hello,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) Then #;6> #,(blubb 1 2) Error: illegal non-atomic object: #<blubb> yields an error -- but why? This works, of course: #;6> (make-blubb 1 2) #<blubb> Any ideas where this strange behaviour comes from? cu, Thomas
[Prev in Thread] | Current Thread | [Next in Thread] |