#2687 call-arguments-limit easily exhaustable in tex1

None
closed
nobody
tex (2)
5
2014-08-15
2014-02-03
Carl Shapiro
No

Unlike tex, tex1 invokes apply on its argument. On systems which have a small call-arguments-limit, this can lead to an error. Consider the following example

tex1(sin(t)/(sin(t)^2+10)-6*sin(t)^3/(sin(t)^2+10)^2 +20*cos(t)^2*sin(t)/(sin(t)^2+10)^2 -48*cos(t)^2*sin(t)^3/(sin(t)^2+10)^3 +24*cos(t)^4*sin(t)/(sin(t)^2+10)^3 -48*cos(t)^4*sin(t)^3/(sin(t)^2+10)^4)$

This evaluation will succeed with a system like CMUCL that has a large call-arguments-limit. With GCL this evaluation will result in the following error

Maxima encountered a Lisp error:

 Error in CONCATENATE [or a callee]: CONCATENATE [or a callee] requires less than one hundred forty-six arguments.

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

I believe this problem can be solved by making tex1 concatenate its arguments by means other than APPLYing a string concatenation function to the list of strings returned by tex.

Discussion

  • Leo Butler
    Leo Butler
    2014-02-03

    The common lisp reduce function, rather than apply, should be used. This is fixed in commit f68b5c7. You can test this by entering the following command in maxima:

    :lisp (defun $tex1 (x) (reduce #'strcat (tex x nil nil 'mparen 'mparen)))

    Then enter your tex1 call above.

     
  • Leo Butler
    Leo Butler
    2014-02-03

    • status: open --> pending
     
  • Robert Dodier
    Robert Dodier
    2014-02-10

    • labels: --> tex
    • status: pending --> closed
     
  • Robert Dodier
    Robert Dodier
    2014-02-10

    commit f68b5c7ca seems to work as advertised. Closing this report.