slib-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Slib-discuss] integer->list and negative integers


From: Shiro Kawai
Subject: [Slib-discuss] integer->list and negative integers
Date: Fri, 27 May 2011 23:56:12 -1000 (HST)

Hi there,

While implementing SRFI-60 for Gauche, I noticed where the spec
and reference implementation seem to disagree.  Since its reference
implementation is from Slib's logical.scm, let me post a question
here.

The current implementation of integer->list doesn't seem to
expect negative integers as k.  If the optional "len" argument
is provided it does what it supposed to do, but otherwise
it always returns ().

 > (integer->list -10 5)
 (#t #f #t #t #f)
 > (integer->list -10)
 ()

Looking at the implementation, it seems a simple overlook and
easily fixable thing.  However, I'm not sure that SRFI-60
actually intends "Bits as booleans" procedure to support
negative integers.   It says:

  integer->list and list->integer are inverses so far as
  equal? is concerned. 

Nevertheless, list->integer spec seems impossible to produce
negative integers.  (Theoretically it may return -1 if a
circular list #1=(1) is passed, though.)

Is the above integer->list behavior is intended, or a bug?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]