Question: permute - gives recursion error

The sample code below generates a message: Error, too many levels of recursion.  It appears to be in the permute function, and seems to be related to variable names I have in my program.  The "error" is intermittent - it appears to work for some but not others eg  aaa:=permute([a,e,i,l,z], mm); does not work but aaa:=permute([e,e,k,n,s], mm); does.  I suspect that it is not liking some variable names in my program.  Any hints or suggestions much appreciated.

 

 

with(combinat, permute):
 for mm from 3 to 5 do
 #aaa:=[]:
 printf("Hello %d\n", mm);
 aaa:=permute([a,e,i,l,z], mm);  #[e,e,k,n,s] works - [e,i,n,s,v]  doesn't - [a,e,i,l,z]
 #These Work: [e,e,s,l,z],[e,i,s,l,z], [e,i,s,l,v], [e,l,i,z,t]
 # These don't:  [a,e,s,l,z],[e,l,i,z,a]
...
od; #for mm

Error, too many levels of recursion

Please Wait...