A for x in e loop runs through other values once its function is translated or compiled, and gives a Lisp error for some values of e that the interpreted loop accepts:
(%i1) display2d : false$
(%i2) f(e) := block([l : []], for u in e do l : endcons(u, l), l)$
(%i3) h[1] : 2$
(%i4) h[3] : 4$
(%i5) [f(x+1), f(a/b), f(sqrt(x)), f(g[1](x, y)), f(rat(x^2+1)), f(h)];
(%o5) [[x,1],[a,b],[x],[x,y],[x^2,1],[[[1],2],[[3],4]]]
(%i6) compile(f)$
(%i7) [f(x+1), f(a/b), f(sqrt(x)), f(g[1](x, y))];
(%o7) [[1,x],[a,1/b],[x,1/2],[g[1],x,y]]
(%i8) f(rat(x^2+1));
Maxima encountered a Lisp error:
The value
1
is not of type
LIST
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i9) f(h);
Maxima encountered a Lisp error:
The value
$H
is not of type
LIST
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i10) f(1.5b0);
(%o10) [54043195528445952,1]
Interpreted, the loop runs through the arguments of e as args(e) gives them, which follow inflag, takes a CRE as its general form, and runs through the entries of a hashed or undeclared array. An atom such as x or 1.5b0 is an error. Translated, the loop runs through the internal form of e, whatever inflag is. So the compiled f gives 1/b where the interpreted one gives b, which is another value and not just another form. It also takes 1/2 for an argument of sqrt(x), g[1] for an argument of g[1](x, y), and the terms of x+1 in another order. A CRE or an array gives a Lisp error, and so does any other atom except a bigfloat, which gives its mantissa and exponent. translate(f) behaves the same.
Fixed by commit [5d32ce].
Related
Commit: [5d32ce]