I don't know whether this is a bug or not. However, it took me some time
to figure out where the problem was in an .input script.
(6) -> i := 2; j := 2; [if i=j then 1 else 0 for j in 1..5]
(6) [1]
Type: List(PositiveInteger)
(7) -> i := 2; j := 2; [(if i=j then 1 else 0) for j in 1..5]
(7) [0, 1, 0, 0, 0]
Type: List(NonNegativeInteger)
I am somewhat sure that it is a bug, because of the attached .spad file.
It behaves as expected and gives the output below, but behaves
differently from what the interpreter does.
(17) -> z1 := [[f1(m,n) for n in 1..5] for m in 1..5];
Type:
List(List(List(Integer)))
(18) -> z2 := [[f2(m,n) for n in 1..5] for m in 1..5];
Type:
List(List(List(Integer)))
(19) -> (z1=z2)@Boolean
(19) true
Type:
Boolean
(20) -> z1
(20)
[
[[1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0],
[1, 0, 0, 0, 0]]
,
[[0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0],
[0, 1, 0, 0, 0]]
,
[[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0],
[0, 0, 1, 0, 0]]
,
[[0, 0, 0, 1, 0], [0, 0, 0, 1, 0], [0, 0, 0, 1, 0], [0, 0, 0, 1, 0],
[0, 0, 0, 1, 0]]
,
[[0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1],
[0, 0, 0, 0, 1]]
]
Type:
List(List(List(Integer)))