makelist(): argument size appears restricted to integer -- RFC
Subject: makelist(): argument size appears restricted to integer -- RFC
From: Richard Fateman
Date: Tue, 21 Apr 2009 17:00:06 -0700
Robyn Dawn Hannigan wrote:
> Hello Again,
>
>
>
> This restriction to a fixnum, or an integer, or whatever. Please
> document it.
Well there are several things wrong with this.
1. if it is a fixnum but exceeds the number of available list cells, it
will crash and burn.
2. if it is an integer but exceeds the number of available list cells,
it will do the same.
3. if it is an integer larger than the most-positive-fixnum, it will
almost always crash and burn.
(depends on details of lisp, memory space, and unknown future computer
architecture).
So fixnum/integer/ documented or not, you are going to have some inputs
for which you will crash and burn.
A more humane version of makelist might do this:
for a number of cells exceeding "max_makelist_size" default (say)
100000 , it gives a error, e.g.
"To use makelist to construct a list larger than max_makelist_size,
currently 100000, please
reset max_makelist_size. This warning is courtesy of the system
programmer who thinks you
may have inadvertently specified too large a list and might have second
thoughts about constructing
it in your (perhaps smaller?) memory."
There are many ways of breaking a computer system that allows users to
attempt to run every algorithm on
data of any size. Changing makelist in the way RD proposed would be
harmless but to a large extent pointless
except in the case that you were intent on breaking Maxima by running
out of memory. And then it probably
would not tell you what you wanted to know with any precision or
necessarily reproducibility.
RJF
> i walked in as a 'user', trying not to think like a
> software author and got had by an undocumented gotcha. Fair enough.
>
> But may i ask in return for giving the devs someone to tell off,
> that the next user doesn't have to ask?
>
> Best Wishes,
> Robyn
>
> PS @RJF i thought all RD did was change the type-check to a less permissive
> type in mstuff.lisp.
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>