makelist(): argument size appears restricted to integer -- RFC
Subject: makelist(): argument size appears restricted to integer -- RFC
From: Richard Fateman
Date: Wed, 22 Apr 2009 07:29:43 -0700
Robyn Dawn Hannigan wrote:
>> I';m going to go ahead and change the test to a test for a general integer.
>> I don't see much point to a specific range test, since it seems likely
>> there is no way to determine the actually workable range.
>> Testing for a fixnum is an implicit range test, and doesn't make any
>> more sense than testing for n < 1000 or 1000000 or whatever.
>>
Actually, testing for n<100000 does make sense as suggested earlier.
(For example, Mathematica has such tests in many places, says you have
reached a bound of some sort, and asks if you want to continue.
It is often helpful. e.g. for stack depth on what appears to be a
suspiciously deep call stack...)
>
> Please can you also patch the docs so this is mentioned. It's a good limit,
> but without a signpost people will still hit it.
No they won't "hit it". It appears to me that the only purpose of the
test will be to give an error message if the difference is not an
integer at all,
but (say) x^2, or 3.5.
> This was by far my greatest
> original concern.
>
Then you were probably concerned about the wrong thing :) Earlier you
said you wanted to run a test to see how big a list you could construct
before memory ran out.
Most people, on running out of memory, complain about inadequate
checking, poor error messages, etc etc. You, on the other hand,
complain about an error message that prevented you from running out of
memory. RD "fixed" the command so that you will not get an error
message, but will in fact run out of memory and (if you choose the wrong
lisp) may get either a far more mysterious error message or perhaps just
a "core dump".
I suggest you consider writing your programs in lisp, which is more
cleanly defined. Maxima's manual is rather vague in some respects, and
using Maxima may not add much unless you actually are doing symbolic
mathematics. For example, you may be able to construct a list that is
considerably larger if you do it in lisp, because the result of a
makelist must be simplified, taking additional time and (probably)
memory. Also, the error messages you get from lisp when you
deliberately run out of resources may make more sense in the context of
lisp. I suggest you write a program (in lisp) that will run out of
stack, floating-point number memory space, string space, and see how
large an array you can allocate. If that is what you are interested in.
RJF
RJF