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
03feca7a
Commit
03feca7a
authored
Apr 14, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some unused imports.
parent
dedcf309
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
src/rules/fractions.py
src/rules/fractions.py
+1
-7
No files found.
src/rules/fractions.py
View file @
03feca7a
from
itertools
import
combinations
,
product
,
ifilterfalse
import
copy
from
.utils
import
least_common_multiple
,
partition
,
is_numeric_node
,
\
evals_to_numeric
from
..node
import
ExpressionNode
as
N
,
ExpressionLeaf
as
L
,
Scope
,
OP_DIV
,
\
OP_ADD
,
OP_MUL
,
OP_POW
,
nary_node
,
negate
OP_ADD
,
OP_MUL
,
negate
from
..possibilities
import
Possibility
as
P
,
MESSAGES
from
..translate
import
_
...
...
@@ -188,16 +187,11 @@ def match_multiply_fractions(node):
p
=
[]
scope
=
Scope
(
node
)
fractions
,
others
=
partition
(
lambda
n
:
n
.
is_op
(
OP_DIV
),
scope
)
numerics
=
filter
(
is_numeric_node
,
others
)
for
ab
,
cd
in
combinations
(
fractions
,
2
):
p
.
append
(
P
(
node
,
multiply_fractions
,
(
scope
,
ab
,
cd
)))
for
ab
,
c
in
product
(
fractions
,
others
):
a
,
b
=
ab
#if (a.is_numeric() and c.is_numeric()) or \
# (a == 1 and evals_to_numeric(b)):
if
c
.
is_numeric
()
or
not
evals_to_numeric
(
ab
):
p
.
append
(
P
(
node
,
multiply_with_fraction
,
(
scope
,
ab
,
c
)))
...
...
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