Closed c50b3d32-6cb1-4b90-a060-6a332e54ef6a closed 10 years ago
Author: Sara Kropf
I believe that | and + should be aliases for union. That's how it works for sets already
sage: Set([1,2,3])+Set([3,4,6])
{1, 2, 3, 4, 6}
sage: Set([1,2,3])|Set([3,4,6])
{1, 2, 3, 4, 6}
And for graphs only + is defined
sage: graphs.PetersenGraph() + graphs.ChvatalGraph()
Petersen graph disjoint_union Chvatal graph: Graph on 22 vertices
sage: graphs.PetersenGraph() | graphs.ChvatalGraph()
...
TypeError: unsupported operand type(s) for |: 'Graph' and 'Graph'
If you agree with that you can add a __or__ = __add__
after the function's definition :-)
Nathann
Well, could you answer yesterday's question ? What do you think ?
Nathann
For me, that sounds good. But I would like to wait for possible other opinions on this topic before I change it, since originally it was suggested to use only __or__
(instead of __add__
).
I will wait until Monday.
Branch pushed to git repo; I updated commit sha1. New commits:
3c34436 | FiniteStateMachine.__add__ is the same as __or__ |
Now __add__
does the same as __or__
, as suggested above.
Oooooooooookayyyyyyyyyyyyyyyyyyyyyyyy !!!
http://grooveshark.com/s/Let+s+Bang/3S4pl4?src=5
Nathann
OOops, nononono. It does not pass tests :-)
sage -t --long finite_state_machine.py # 2 doctests failed
Replying to @sagetrac-skropf:
For me, that sounds good. But I would like to wait for possible other opinions on this topic before I change it, since originally it was suggested to use only
__or__
(instead of__add__
).I will wait until Monday.
I am Ok for __add__
having the same behavior as __or__
.
But, do we agree that __mul__
should not link to __and__
? To me, if A and B are two automata, A * B means the concatenation of them, not the intersection.
Sébastien
Yepyep, in the current patch we only have an alias from add to or.
Nathann
Replying to @nathanncohen:
OOops, nononono. It does not pass tests
:-)
sage -t --long finite_state_machine.py # 2 doctests failed
I don't know what you mean. For me, all doctests pass.
Can you check it again, please, and tell me your error messages?
My mistake ! I must have forgotten to recompile or something. Sorry for that, good to go :-)
Nathann
Reviewer: Nathann Cohen
Changed branch from u/skropf/fsm/and-intersection-or-union to 3c34436
Nevertheless, intersection and union are still not implemented. Thus, this only changes the names of the functions. Previously
__mul__
called intersection and__add__
called union.This is an answer to one of the comments in #15078 comment:32.
CC: @dkrenn @cheuberg @seblabbe
Component: combinatorics
Author: Sara Kropf
Branch/Commit:
3c34436
Reviewer: Nathann Cohen
Issue created by migration from https://trac.sagemath.org/ticket/16016