Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
26b4d442
Commit
26b4d442
authored
Jan 05, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite two constants into one constant (in combine_numerics).
parent
7f4097c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
src/rules/poly.py
src/rules/poly.py
+14
-1
No files found.
src/rules/poly.py
View file @
26b4d442
from
itertools
import
combinations
from
itertools
import
combinations
from
..node
import
ExpressionNode
as
Node
,
TYPE_OPERATOR
,
OP_ADD
,
OP_MUL
from
..node
import
ExpressionNode
as
Node
,
ExpressionLeaf
as
Leaf
,
\
TYPE_OPERATOR
,
OP_ADD
,
OP_MUL
from
..possibilities
import
Possibility
as
P
from
..possibilities
import
Possibility
as
P
from
.utils
import
nary_node
from
.utils
import
nary_node
...
@@ -110,6 +111,18 @@ def match_combine_polynomes(node, verbose=False):
...
@@ -110,6 +111,18 @@ def match_combine_polynomes(node, verbose=False):
return
p
return
p
def
combine_numerics
(
root
,
args
):
"""
Combine two constants to a single constant in an n-ary plus.
Synopsis:
c0 + c1 -> eval(c1 + c2)
"""
c0
,
c1
=
args
return
Leaf
(
c0
.
value
+
c1
.
value
)
def
combine_polynomes
(
root
,
args
):
def
combine_polynomes
(
root
,
args
):
"""
"""
Combine two multiplications of any polynome in an n-ary plus.
Combine two multiplications of any polynome in an n-ary plus.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment