Open vsht opened 10 months ago
In a discussion of Issue #78, Jos said
Vector sets can only consist of vectors like p, not -p.
So, I guess there was an implicit assumption that the definition of a set in the reference manual,
A set is a (non-empty) collection of variables that should all be of the same type.
was also applied to implicitly declared sets; sums of variables are not expected. Then, it was extended to allow "minus vectors" like -p
in v4.2.0.
Indeed, usual Set
statements and implicitly declared sets seem to share the parser (which sounds reasonable); the same happens also for usual set declarations.
On names;
V p1,p2;
Set pp: p1,p2,p1+p2;
.end
and
On names;
V p1,p2;
CF f;
id f(p1?{p1,p2,p1+p2}) = 1;
.end
are accepted by FORM but print the set as p1 p2 p1 -p2
. Interestingly, the last element of the set (-p2
) has a minus sign. If I change Vectors
to Symbols
,
S p1,p2;
Set pp: p1,p2,p1+p2;
.end
then this gives an error:
test.frm Line 2 --> Illegal use of - sign in set. Can use only with vector or n
umber
which sounds like the routine is very "optimized" to parse minus vectors.
Having said that, FORM should give appropriate errors if they are not allowed (as Ben said in #78), so I would call it a kind of "bug".
Hi,
as I understand, FORM actually only supports implicit vectors sets where each element is a single vector. Nevertheless, the following code "works" with a somewhat unexpected result:
yields
It seems that in this case the compiler interprets
{k1,-k1, k2,-k2,k1+k2,k1-k2,-k1-k2,-k1+k2,k3,-k3}
as{k1,-k1, k2,-k2,k1,k2,k1,-k2,-k1,-k2,-k1,+k2,k3,-k3}
which can be confirmed by trying to write an id statement that uses the position of the element in a setleads to
Is this behavior mentioned somewhere in a manual, or would one rather classify it as a bug?
Cheers, Vlad