From: jurgen_defurne
Subject: Differences between types
Date: 
Message-ID: <601ef647-c9a6-419f-9098-73ec555c392b@41g2000yqf.googlegroups.com>
When I do the following :

[4]> (type-of 13000)
(INTEGER 0 16777215)
[5]> (type-of 4294967295)
(INTEGER (16777215))

If I look at the CLHS, I understand that the first one is an integer
between 0 and 16777215. However, I do not find a description of the
second one. Does it mean an integer of maximum size 2^16777215 ?

Regards,

Jurgen

From: Rob Warnock
Subject: Re: Differences between types
Date: 
Message-ID: <WdSdnWIhI5PfLAPUnZ2dnUVZ_uidnZ2d@speakeasy.net>
jurgen_defurne  <··············@pandora.be> wrote:
+---------------
| When I do the following :
| 
| [4]> (type-of 13000)
| (INTEGER 0 16777215)
| [5]> (type-of 4294967295)
| (INTEGER (16777215))
| 
| If I look at the CLHS, I understand that the first one is an integer
| between 0 and 16777215.
+---------------

Caution: This is somewhat implementation-dependent.
E.g., CMUCL always shows the types of integers this way:

    cmu> (type-of 13000)

    (INTEGER 13000 13000)
    cmu> (type-of 4294967295)

    (INTEGER 4294967295 4294967295)
    cmu> 

This is not unreasonable in an implementation with a compiler with
type propagation, since integers are immutable and therefore both
the lower and upper ranges of the type can legally be described as
the integer itself. Note that this is the *most*-specific possible
type for an integer. CMUCL also recognizes less-specific types, of
course:

    cmu> (subtypep (type-of 13000) 'fixnum)

    T
    T
    cmu> (subtypep (type-of 4294967295) '(integer 4294967290 4294967299))

    T
    T
    cmu> (subtypep (type-of 4294967295) '(integer 0 18446744073709551615))

    T
    T
    cmu> 


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Kojak
Subject: Re: Differences between types
Date: 
Message-ID: <20090220092353.0af3e4be@thor.janville.org>
Le Fri, 20 Feb 2009 00:13:32 -0800 (PST),
jurgen_defurne a écrit :

> When I do the following :
> 
> [4]> (type-of 13000)
> (INTEGER 0 16777215)
> [5]> (type-of 4294967295)
> (INTEGER (16777215))
> 
> If I look at the CLHS, I understand that the first one is an integer
> between 0 and 16777215. However, I do not find a description of the
> second one. Does it mean an integer of maximum size 2^16777215 ?

The two numbers mean lower and upper limit and one number the lower
limit.

-- 
Jacques.
From: chthon
Subject: Re: Differences between types
Date: 
Message-ID: <9bdc7cea-2abf-4ce9-97a4-d08ffbf35191@h5g2000yqh.googlegroups.com>
On Feb 20, 9:23 am, Kojak <·······@janville.Borg.invalid> wrote:
> Le Fri, 20 Feb 2009 00:13:32 -0800 (PST),
> jurgen_defurne a écrit :
>
> > When I do the following :
>
> > [4]> (type-of 13000)
> > (INTEGER 0 16777215)
> > [5]> (type-of 4294967295)
> > (INTEGER (16777215))
>
> > If I look at the CLHS, I understand that the first one is an integer
> > between 0 and 16777215. However, I do not find a description of the
> > second one. Does it mean an integer of maximum size 2^16777215 ?
>
> The two numbers mean lower and upper limit and one number the lower
> limit.
>
> --
> Jacques.

Aha! So this is the expression of the disjointedness between fixnum
and bignum ?
[ 0, 1 ] as bit type
[ 2, 16777215 ] as (integer 0 16777215)
[ 16777216, ... [ as something > 16777215

Thanks for the clarification.

Regards,

Jurgen
From: Kojak
Subject: Re: Differences between types
Date: 
Message-ID: <20090220105927.224cdc2a@thor.janville.org>
Le Fri, 20 Feb 2009 00:42:59 -0800 (PST),
chthon a écrit :

> Aha! So this is the expression of the disjointedness between fixnum
> and bignum ?
> [ 0, 1 ] as bit type
> [ 2, 16777215 ] as (integer 0 16777215)
> [ 16777216, ... [ as something > 16777215

Right, it gives you the type of object as above:
BIT, FIXNUM, BIGNUM...

-- 
Jacques.