Hi,
here is my program :
/**
* This function generates structured data from a flatten list.
*
* The list "l" must be a flatten list with 4 * nbElements * nbElements.
*
* For each set of 4 values, it creates a list of two sub-lists of 2 elements
*
* Example :
*
* l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
*
* result : [ [ [1,2], [3,4] ],
* [ [5,6], [7,8] ],
* [ [9,10], [11,12] ],
* [ [13,14], [15,16] ] ]
*/
generate_data(l):=(
/* If the list is empty, we stop th recursion */
if is(l = []) then []
/* else, we generate a list of two sub-lists */
else append([[[first(l), second(l)],
[third(l), fourth(l)]]],
generate_data(rest(l,4))) /* we call the same function into the rest of th e list*/
)$
/**
* Creates a flatten list of "nbElements * nbElements * 4" values (numbers).
* Runs the generation of structured data
*/
go(nbElements):=(
l:makelist(i,i,1,nbElements*nbElements*4),
generate_data(l)
)$
In maxima :
(%i1) load(example);
(%o1) example.max
(%i2) go(30)$
(%i3) go(31)$
*** - D?bordement de pile Lisp : RAZ
[1]>
(%i2) -> no problem
(%i3) -> error : stack overflow Lisp : RAZ
Martin
> Message du 14/06/07 18:06
> De : "Robert Dodier" <robert.dodier at gmail.com>
> A : "Martin DRUON" <martin.druon at wanadoo.fr>
> Copie ? : maxima at math.utexas.edu
> Objet : Re: [Maxima] clisp stack overflow
>
> On 6/14/07, Martin DRUON <martin.druon at wanadoo.fr> wrote:
>
> > I would like to know if it's possible to change the amount of memory reserved for maxima
> > (or reserved for clisp) because when I run a simple program onto a list
> > (only 3,844 elements !!!) it craches and return a "stack overflow Lisp"
> > (but it works for 3,600 elements) !
>
> Martin, please tell us more about this problem. Is the error coming
> from a Maxima built-in function or a function you wrote?
> Maybe you can show us the code in question.
>
> Maxima doesn't have any capability to turn recursive function
> calls into iteration, unfortunately. Perhaps an unbounded recursion
> has something to do with your problem.
>
> > Can I change the amount of memory directly in maxima ?
> > if isn't, how I can change the call to clisp at the begining of maxima
> > to increase the amount of memory (I read that the default value for
> > clisp is 2MB !) ?
>
> In cases that I can remember, running out of memory in
> Maxima is a symptom of a deeper underlying problem
> (e.g. an algorithm for which memory use increases exponentially)
> so just allocating more memory rarely solves the problem.
>
> All the best
> Robert Dodier
>
>