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)))
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/0365fbe5-9886-f4f1-918b-ea7c5aecd9a8%40hemmecke.org.
)abbrev domain FOO Foo
Foo(): with
f1: (Integer, Integer) -> List Integer
f2: (Integer, Integer) -> List Integer
== add
f1(i: Integer, j: Integer): List Integer ==
[if i=j then 1 else 0 for j in 1..5]
f2(i: Integer, j: Integer): List Integer ==
[(if i=j then 1 else 0) for j in 1..5]