Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
The relevant java code is in Bignum.java: (the value field is a java BigInteger)
@Override public LispObject typeOf() { if (value.signum() > 0) return list(Symbol.INTEGER, new Bignum((long)Integer.MAX_VALUE + 1)); return Symbol.BIGNUM; }
for comparison: CL-USER(23): (type-of -1234567898723618080928927362387) BIGNUM
which makes intuitive sense.
archisman rudra archi.rudra@gmail.com writes:
Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
Sure.
(typep 1234567898723618080928927362387 '(INTEGER 2147483648)) => T
Zach
Thanks guys, that was clarifying.
On Tue, Oct 9, 2012 at 3:03 PM, Zach Beane xach@xach.com wrote:
archisman rudra archi.rudra@gmail.com writes:
Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
Sure.
(typep 1234567898723618080928927362387 '(INTEGER 2147483648)) => T
Zach
Hi Archisman,
On Tue, Oct 9, 2012 at 8:34 PM, archisman rudra archi.rudra@gmail.comwrote:
Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
Yes: BIGNUM is defined as "INTEGER, but not FIXNUM". (INTEGER 2147483648) is much more restrictive than BIGNUM: it disallows all negative values which are part of the BIGNUM definition.
HTH,
Erik.
My confusion is whether it matters that 2147483648 < 1234567898723618080928927362387
Doesn't the type descriptor (INTEGER 2147483648) mean integers upto 2147483648?
thanks
On Tue, Oct 9, 2012 at 3:12 PM, Erik Huelsmann ehuels@gmail.com wrote:
Hi Archisman,
On Tue, Oct 9, 2012 at 8:34 PM, archisman rudra archi.rudra@gmail.comwrote:
Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
Yes: BIGNUM is defined as "INTEGER, but not FIXNUM". (INTEGER 2147483648) is much more restrictive than BIGNUM: it disallows all negative values which are part of the BIGNUM definition.
HTH,
Erik.
On Tue, Oct 9, 2012 at 3:42 PM, archisman rudra archi.rudra@gmail.com wrote:
My confusion is whether it matters that 2147483648 < 1234567898723618080928927362387
Doesn't the type descriptor (INTEGER 2147483648) mean integers upto 2147483648?
No, it means integers > 2147483648
it is (integer low &optional high)
-Alan
archisman rudra archi.rudra@gmail.com writes:
My confusion is whether it matters that 2147483648 < 1234567898723618080928927362387
Doesn't the type descriptor (INTEGER 2147483648) mean integers upto 2147483648?
No, the INTEGER type specifier takes two arguments. The first one expresses the lower bound, and the optional second the upper bound. If the second argument is omitted, it defaults to *, meaning no upper bound.
(MOD 2147483648) is more what you're thinking of.
Zach
Thanks, that was my error. This flurry of emails made me go look at the hyperspec.
On Tue, Oct 9, 2012 at 3:48 PM, Zach Beane xach@xach.com wrote:
archisman rudra archi.rudra@gmail.com writes:
My confusion is whether it matters that 2147483648 < 1234567898723618080928927362387
Doesn't the type descriptor (INTEGER 2147483648) mean integers upto
2147483648?
No, the INTEGER type specifier takes two arguments. The first one expresses the lower bound, and the optional second the upper bound. If the second argument is omitted, it defaults to *, meaning no upper bound.
(MOD 2147483648) is more what you're thinking of.
Zach
On Tue, Oct 9, 2012 at 2:34 PM, archisman rudra archi.rudra@gmail.comwrote:
Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
The relevant java code is in Bignum.java: (the value field is a java BigInteger)
@Override public LispObject typeOf() { if (value.signum() > 0) return list(Symbol.INTEGER, new Bignum((long)Integer.MAX_VALUE + 1)); return Symbol.BIGNUM; }
for comparison: CL-USER(23): (type-of -1234567898723618080928927362387) BIGNUM
which makes intuitive sense.
http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm
*Relevant bits of type-of description:*
Returns a *type specifier*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type_specifier , *typespec*, for a *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type that has the *object* as an *element*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_e.htm#element. The *typespec* satisfies the following:
1. For any *object* that is an *element*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_e.htm#element of some *built-in type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_b.htm#built-in_type :
a. the *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type returned is a *recognizable subtype*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_r.htm#recognizable_subtype of that *built-in type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_b.htm#built-in_type .
b. the *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type returned does not involve and, eql, member, not, or, satisfies, or values.
3. The *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type returned by *type-of*http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm#type-of is always a *recognizable subtype*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_r.htm#recognizable_subtype of the *class*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_c.htm#class returned by *class-of*http://www.lispworks.com/documentation/lw51/CLHS/Body/f_clas_1.htm#class-of. That is,
(subtypep (type-of object) (class-of object)) => true http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#true, true http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#true
So my read is that there's no guarantee of literal repeatability between the returned values of type-of even in subsequent calls, never mind between implementations.
-Alan
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
Ah, I see. There is freedom on the part of implementations here.
thanks
On Tue, Oct 9, 2012 at 3:36 PM, Alan Ruttenberg alanruttenberg@gmail.comwrote:
On Tue, Oct 9, 2012 at 2:34 PM, archisman rudra archi.rudra@gmail.comwrote:
Is this correct behavior?
CL-USER(17): (type-of 1234567898723618080928927362387) (INTEGER 2147483648)
The relevant java code is in Bignum.java: (the value field is a java BigInteger)
@Override public LispObject typeOf() { if (value.signum() > 0) return list(Symbol.INTEGER, new Bignum((long)Integer.MAX_VALUE + 1)); return Symbol.BIGNUM; }
for comparison: CL-USER(23): (type-of -1234567898723618080928927362387) BIGNUM
which makes intuitive sense.
http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm
*Relevant bits of type-of description:*
Returns a *type specifier*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type_specifier , *typespec*, for a *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type that has the *object* as an *element*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_e.htm#element. The *typespec* satisfies the following:
- For any *object* that is an *element*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_e.htm#element of
some *built-in type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_b.htm#built-in_type :
a. the *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type returned is a *recognizable subtype*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_r.htm#recognizable_subtype of that *built-in type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_b.htm#built-in_type .
b. the *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type returned does not involve and, eql, member, not, or, satisfies, or values.
- The *type*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type returned
by *type-of*http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm#type-of is always a *recognizable subtype*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_r.htm#recognizable_subtype of the *class*http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_c.htm#class returned by *class-of*http://www.lispworks.com/documentation/lw51/CLHS/Body/f_clas_1.htm#class-of. That is,
(subtypep (type-of object) (class-of object)) => true http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#true, true http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#true
So my read is that there's no guarantee of literal repeatability between the returned values of type-of even in subsequent calls, never mind between implementations.
-Alan
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
armedbear-devel@common-lisp.net