And...in your cost function, consider using 'reduce' instead of (apply #'+ .... Using GCL: OK: (%i16) cost(sum(concat(a,k),k,1,6)); (%o16) 7 Not OK: (%i17) cost(sum(concat(a,k),k,1,65)); Maxima encountered a Lisp error: Error in APPLY [or a callee]: Lisps arglist maximum surpassed Barton