On Sep 25, 2006, at 10:07 AM, Marc Feeley wrote:
On 23-Sep-06, at 4:29 PM, Bradley Lucier wrote:
Marc:
I found a few more problems---in FIXLENGTH you want to set ___temp to -___temp (not ~temp) when ___temp is negative (try (fxlength -1)),
This is incorrect.
Well, it may be incorrect that you want it, but otherwise it's a matter of convention.
Note that the definition of fxlength in R6RS uses ~temp (SRFI 77 erroneously used -temp). With ~temp it matches the Common Lisp semantics, i.e. (fxlength -1) = 0.
Gotcha. I was looking at the SRFI-77 code.
This has been rather extensively tested on 32-bit (ppc) and 64-bit (x86-64) platforms by comparing it with the R6RS definitions of the same functions. The diff is from the original gambit.h.
For (fxfirst-bit-set 0) the R6RS specifies that -1 should be returned. I see no reason why -1 should be viewed as the correct answer. It seems too arbitrary. The "Scheme way" is to return #f, in fact that's what Gambit's (first-set-bit 0) returns. What do you think?
Well, I don't know ... Clinger made a lot of noise during the SRFI-77 process about making numerical code more conducive to type checking. Having functions return {#f}\union{numbers} is useful and Schemely, but using a numeric code is also useful.
Perhaps you should send a comment to R6RS to get (fx-first-bit-set 0) => #f if you believe strongly that it should be changed. In the end, though, I think Gambit should have the R6RS semantics for this function.
Brad