Hi!

I bet that the behavior I describe below is well known to fricas developers,
but I report this because I find it fun and awful at the same time...

1) WARM-UP:
IF I understand well, my UG's readings, SPAD and Aldor have **different 
semantics** for commas. N>=2 below.

* in Aldor (expr1, expr2,..,exprN) is a tuple (multivalue) and {expr1; 
expr2;..; exprN}
is a sequence of expression evaluated in that order. Parentheses () and braces 
{} are
used for precedence's sake and 99% interchangeable (different behavior for 
external trailing semicolon).
Aldor allows internal trailing semicolon in blocks {e1;e2;e3;} while this is an 
error in spad.

* In Spad (expr1, expr2,..,exprN) is a tuple (not really, see point 2)
while  {e1;..; eN} **AND** {e1,..,eN} are sequences of expressions evaluated in 
the order.

OK, I find Aldor semantics much more clean & logic than that of Spad, but this 
is not the problem.

2) THE MYSTERY:
The mysterious behavior is this one: one would expect that "{expression}" has a 
value equal to "expression,
but this is NOT the case in the interpreter if "expression" is a tuple.

(1) -> {1;2;3} -- this is a sequence of expressions in a block, OK.

   (1)  3
                                                        Type: PositiveInteger
(2) -> {1,2,3} -- this is a sequence of expressions in a block, OK.

   (2)  3
                                                        Type: PositiveInteger
(3) -> 1,2,3 -- tuple

   (3)  [1, 2, 3]
                                                 Type: Tuple(PositiveInteger)
(4) -> (1,2,3) -- tuple

   (4)  [1, 2, 3]
                                                 Type: Tuple(PositiveInteger)
(5) -> {"bum"}  --{expr} same as expr? YES

   (5)  "bum"
                                                                 Type: String
(6) -> {(1,2,3)}  --{expr} same as expr? NOOOO

   (6)  3
                                                        Type: PositiveInteger
(7) -> ((1,2),(3,4)) --tuple of tuples

   (7)  [(1, 2), (3, 4)]
                                          Type: Tuple(Tuple(PositiveInteger))
(8) -> {((1,2),(3,4))} -- tuple of tuples? NOOOOO

   (8)  [3, 4]
                                                 Type: Tuple(PositiveInteger)

In the example above I would have expected [1,2,3] as result of (6) and 
[[1,2],[3,4]] as result of (8).

As a second choice I would have expected syntax errors because, for instance,
in (6) I try to see  "(1"  as first expression in a comma separated sequence
of expressions but it is not a well formed expression. Same for "((1,2)" in (8).

It is like the semantics of commas (,...,) for tuple is forgotten inside
a singleton block and mutated to that of a sequence.

weird feature...

regards
ric




--
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to