Ralf Hemmecke
2018-06-27 21:15:51 UTC
Ricardo made me aware that the formulations in
http://fricas.github.io/book.pdf Section 5.3 maybe a bit confusing to
new users.
We all know that Void is the type used in situations where there is no
value. However the Book says on page 149:
If the else clause is missing then the entire expression returns the
unique value of Void.
Uh? So Void doesn't mean "no value"?
Even more funny then is this
(1) -> A := if 1<2 then 1
(1) 1
Type: PositiveInteger
(2) -> A
(2) 1
Type: PositiveInteger
(3) -> B := if 2<1 then 1
You cannot assign an object of type Void to any identifier, (in
particular, ??? ).
(3) -> 3::Void
Type: Void
(4) -> C := 3::Void
You cannot assign an object of type Void to any identifier, (in
particular, ??? ).
So the Book uses the word "value" with different meanings. The value
with type Void cannot be used any further, i.e., is not assignable to
any identifier.
Furthermore, (1) does not behave as described, because "if 1<2 then 1"
should be of type Void and not of type PositiveInteger.
It's understandable that FriCAS chooses to return 1 in case (1), because
otherwise it wouldn't be intuitive for a user. I'm pretty sure that
something like (1) wouldn't work in the compiler, but shouldn't we
change the documentation and explain, that "if" behaves differently in
interpreter vs compiler?
Any suggestions?
Ralf
http://fricas.github.io/book.pdf Section 5.3 maybe a bit confusing to
new users.
We all know that Void is the type used in situations where there is no
value. However the Book says on page 149:
If the else clause is missing then the entire expression returns the
unique value of Void.
Uh? So Void doesn't mean "no value"?
Even more funny then is this
(1) -> A := if 1<2 then 1
(1) 1
Type: PositiveInteger
(2) -> A
(2) 1
Type: PositiveInteger
(3) -> B := if 2<1 then 1
You cannot assign an object of type Void to any identifier, (in
particular, ??? ).
(3) -> 3::Void
Type: Void
(4) -> C := 3::Void
You cannot assign an object of type Void to any identifier, (in
particular, ??? ).
So the Book uses the word "value" with different meanings. The value
with type Void cannot be used any further, i.e., is not assignable to
any identifier.
Furthermore, (1) does not behave as described, because "if 1<2 then 1"
should be of type Void and not of type PositiveInteger.
It's understandable that FriCAS chooses to return 1 in case (1), because
otherwise it wouldn't be intuitive for a user. I'm pretty sure that
something like (1) wouldn't work in the compiler, but shouldn't we
change the documentation and explain, that "if" behaves differently in
interpreter vs compiler?
Any suggestions?
Ralf
--
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+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
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+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.