Hi!
I wonder whether the following behaviour is intended. And if so,
I would be curious about the reasons and where to read more about
it. This doesn't seem to be documented:
(%i1) foo:[1,2,3];
(%o1) [1, 2, 3]
(%i2) mytest1(x)::=cons(x, [a,b,c]);
(%o2) mytest1(x) ::= cons(x, [a, b, c])
(%i3) mytest2(x)::=cons([a,b,c], x);
(%o3) mytest2(x) ::= cons([a, b, c], x)
(%i4) mytest1(foo);
(%o4) [[1, 2, 3], a, b, c]
(%i5) mytest2(foo);
2ND argument value `foo' to cons was not a list
#0: mytest2(x=foo)
-- an error. Quitting. To debug this try debugmode(true);
(%i6) mytest3(x)::=cons([a,b,c], ev(x));
(%o6) mytest3(x) ::= cons([a, b, c], ev(x))
(%i7) mytest3(foo);
(%o7) [[a, b, c], 1, 2, 3]
The behaviour of mytest2 and mytest3 is what I would expect. But why
is foo evaluated in mytest1?
TIA Harald