Comments (4)
To me, it looks like the problem is how you are using the Pattern
class for pattern_1
: Only the first argument is the actual pattern expressions, all the remaining arguments are expected to be constraints (see the docs). As a result, the actual pattern in the first case is only f_B()
, which is correctly found three times. The second pattern is quite different, so you also get a different match.
Is rest[0]
a sequence variable? It would be helpful if you could provide those details.
What do you want pattern_1
to look like? By itself, f_B(), rest[0]
(without any enclosing operator) is not a valid expression.
I am a bit surprised that pattern_1 = Pattern(f_B(), rest[0])
doesn't produce an error. Perhaps it would be good if it did.
from matchpy.
rest[0]
is indeed a sequence variable.
I wanted pattern_1
to look like pattern_2
. The reason I wrote pattern_1
this way is that I found this different behavior per accident and this result looked exactly like what I am looking for.
from matchpy.
Do you know now how to achieve what you are looking for? If yes, I will close this issue.
from matchpy.
Yes, now i know what i needed to know. Thank you.
from matchpy.
Related Issues (20)
- Need Help in code generation. HOT 7
- Not Compatible with Python 3.7 HOT 4
- Wildcard that matches multiple symbols HOT 1
- Create `new` class method on Symbol HOT 1
- ManyToOneMatcher: Position of constraints logic HOT 3
- GPL'd dependency: hopcroftkarp library HOT 6
- Usage of type unions HOT 1
- [Feature] Visualization of Expressions with Graphviz
- ANN: MatchPyCpp port to C++ HOT 7
- New release? HOT 5
- Remove dependency on pkg_resources/setuptools HOT 1
- Improve checking correctness of input
- Match arbitrary function HOT 4
- One-to-one matching: symbols with variable_name do not work in commutative functions HOT 2
- substitute not working with SymPy HOT 11
- Optional wildcards to match the identity element of the current node HOT 7
- FreeQ equivalent in MatchPy? HOT 1
- New MatchPy version? HOT 5
- Expression matching with patterns without wildcards HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matchpy.