Search code examples
lispcopy-pastemaxima

Function definition in Maxima CAS


I have a function :

GiveBTree(z, depthMax):=block(

    [ zz, t1, t2, tmp],
    zz :[], 
    t1 :[z], 
    t2 :[], 
    tmp  :[], 
        
    for depth : 1 thru depthMax step 1 do (
        
        
        for z in t1 do (
            tmp : Give2Preimages(z),
            zz : append(tmp, zz),
            t2 : append(tmp, t2)
            
        )
        
        tmp:[],
        t1:t2 
        
    ),
    
    zz:flatten(zz),     
    return (zz)
)$

When I put it in the Maxima I have :

Maxima 5.43.2 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) GiveBTree(z, depthMax):=block(
[ zz, t1, t2, tmp],
zz :[], 
t1 :[z], 
t2 :[], 
tmp  :[], 

Display all 2857 possibilities? (y or n)
                                       JACOBI_CD
!                                      JACOBI_CN
!!                                     JACOBI_CS
#                                      JACOBI_DC
$                                      JACOBI_DN

The problem seems to start after tmp.

So I checked:

  • googled : maxima cas "Display all"
  • index of Maxima functions
  • describe(tmp)

What is wrong with this definition ?


Solution

  • I have done the steps as Robert Dodier said:

    (%i2) load("g.mac");
    (%o2)                                g.mac
    

    So the problem was caused by "copy and paste".