Subject: Re: Difference between EQ and EQL
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 16 Jan 2008 21:21:41 -0600
Newsgroups: comp.lang.lisp
Message-ID: <jq2dnRscQP5YVBPanZ2dnUVZ_qCunZ2d@speakeasy.net>
Edi Weitz  <spamtrap@agharta.de> wrote:
+---------------
| BTW, is there anything in the ANSI spec that says something about the
| behaviour of FIXNUMs?  The only thing I could find (I didn't spend
| much time, though) is that the type has to be a supertype of
| (SIGNED-BYTE 16).  Everyhing else is implementation-dependent?
+---------------

As Kent noted in a parallel, yeah, mostly. EXCEPT...

MOST-POSITIVE-FIXNUM actually must be greater than *both* 2^15 - 1
and ARRAY-DIMENSION-LIMIT ("A positive fixnum, the exact magnitude of
which is implementation-dependent, but which is not less than 1024").
And not only that, but the *product* of all the dimensions of any
array must also be less than ARRAY-TOTAL-SIZE-LIMIT... which *also*
is required to be a FIXNUM!!

So for any "reasonable" CL implementation, you want FIXNUMs to be
as large as feasible, to keep from imposing a limit on the size of
your arrays. This constraint is more severe for arrays of BASE-CHAR
(SIMPLE-BASE-STRINGs), since they're likely to need more subscript
space per megabyte than arrays of LONG-FLOAT, say.  ;-}


-Rob

p.s. In 32-bit CMUCL, MOST-POSITIVE-FIXNUM is 536870911, which isn't
normally a issue since by default CMUCL has a limit of 512 MiB on
dynamic space anyway. But you can run it in such a way that it *does*
become an limit:

    $ cmucl -dynamic-space-size 1500
    ...[chatter]...
    cmu> (defvar *monster* (make-array 536870910
				       :element-type '(unsigned-byte 8)))

    *MONSTER*
    cmu> (room)

    Dynamic Space Usage:      543,672,424 bytes (out of 1,500 MB).
    Read-Only Space Usage:     20,614,808 bytes (out of  256 MB).
    Static Space Usage:         2,968,696 bytes (out of  256 MB).
    Control Stack Usage:              484 bytes (out of  128 MB).
    Binding Stack Usage:               96 bytes (out of  128 MB).
    The current dynamic space is 0.
    Garbage collection is currently enabled.

    Breakdown for dynamic space:
	536,915,976 bytes for       671 simple-array-unsigned-byte-8-type objects.
	  7,356,408 bytes for   874,654 other objects.
	544,272,384 bytes for   875,325 dynamic objects (space total.)

    cmu> (defvar *monster2* (make-array 536870911  ; just a *tiny* bit bigger
				        :element-type '(unsigned-byte 8)))
    Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
       536870911 is not of type (OR (MOD 536870911) CONS NULL)
       [Condition of type TYPE-ERROR]

    Restarts:
      0: [ABORT] Return to Top-Level.
    ...[debugger prompt]...

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607