Comments (1)
Not nicely as far as I can tell.
the best I could come up with is:
def check_seq(seq):
return len(seq)==3 and seq[1] == 0 and seq[0]==seq[2]
def match_seq(seq):
return 2* seq[0]
and then have the pattern just be check_seq...then you end up with:
check_seq, lambda a: match_seq(a)
This isn't great because you loose the patterns but it is compact.
from pampy.
Related Issues (20)
- Return function without call HOT 1
- Support regex library
- Does Any support more than one array element? HOT 1
- Typing support HOT 3
- "Type Dict cannot be instantiated" error when executing code line from readme HOT 7
- Iterable type checking on first element
- Potential features: Conditionals, Negative Patterns, And Pattern Completion
- Match on 2d list ?
- Proposed New Syntax HOT 1
- A version with enum support does not seem to be published HOT 1
- Matching binary strings HOT 1
- raise in match HOT 1
- accessibility on readme
- add raise_error function HOT 1
- Guard support ?
- Document differences to "PEP: 622 Structural Pattern Matching Version" HOT 1
- publish for conda
- Possibilty to match same object
- Project still alive? HOT 1
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 pampy.