little recursion yields stack-overflow



Hi,

I have a little function arithprog_ohg(k,n)
(for creating hypergraphs of arithmetic progressions,
as used in additive combinatorics; I don't think
the code matters, but for completeness it is given
below). 

It recurses in its second argument (n -> n-1), and
for an input say k=7, n=300 creates a list of length around 7000,
each entry a set with 7 elements. This I consider as rather
tiny, but somehow recently (perhaps with ECL -> 9.4.1)
I get (this on a 64-bit machine --- on a 32-bit machine it breaks
down even earlier):

(%i2) length(arithprog_ohg(7,300)[2]);
Evaluation took 1.3800 seconds (1.3960 elapsed)
(%o2) 7350
(%i3) length(arithprog_ohg(7,350)[2]);

Maxima encountered a Lisp error:

 BINDING-STACK overflow at size 8448. Stack can probably be resized.

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.


This used to work with much larger n. Actually on the 32-bit machine I get

C-STACK overflow at size 139456. Stack can probably be resized.

None of these restrictions should be due to the operating system (Linux;
ulimit shows that everything is set to "unrestricted", and 4 resp. 8 GB
are available). Now how to reset all these bounds to reasonable values
(say, one GB)?

I guess that's Ecl-related, but I couldn't find any information, and so
I thought I ask here first. For the record, here's the function definition:

arithprog_ohg(k,n) := block([V : create_list(i,i,1,n), VS],
  VS : setify(V),
  if elementp(k,{0,1,2}) then return([V,listify(powerset(VS,k))]) 
  elseif n < k or k < 0 then return([V,[]]) 
  elseif k = n then return([V,[VS]]) else
  return([V, 
    append(arithprog_ohg(k,n-1)[2], 
           create_list(setify(
             create_list(n-d*i,i,0,k-1)), 
               d,1,floor((n-1)/(k-1))))]))$

Oliver

P.S. Sure, one can eliminate the recursion here, but I don't use Lisp and Maxima in order
to care about such details (it should be easier than to write a C-program, not harder).