Questions tagged [pattern-matching]
Finding sequences of data that have a particular structure or matching specific criteria or rules. For character pattern defined by a regular expression, use the tag regular-expressions instead.
36 questions
2 votes
5 answers
3k views
Pattern Matching on Request Body for Routing an HTTP Request
In an HTTP application, I think about routing requests based not only on the path, but also based on the request body. For an example, think about the following two different body schemas for a PUT ...
0 votes
1 answer
89 views
Extending TypeScript while being futureproof [closed]
C#10 Has extended the property pattern ability, I think it began since #7 EG: { Car: { Interior: pattern } } Meaning you can do some nice pattern matching even in if statements if (car_var is ...
2 votes
2 answers
3k views
How to find matching profiles?
I'm developing backend for a dating app, in which each user has a profile of his/her characteristics a profile of ideal match's characteristics There are dozens of characteristics like gender, ...
1 vote
1 answer
63 views
Managing cache when matching datas
I'm retrieving values from 3 tables in database and trying to make them match. I was wondering how I could manage cache in an elegant way. I can't change the database structure even though one of the ...
0 votes
1 answer
271 views
Sequence matching problem is complicated, how can I break it down into easier smaller pieces?
I have two lists: 1: 1) A abc 2) A def 3) A ghi 4) B jkl 5) B mno 6) C fzy 7) C xxa 2: 1) vsf 2) jkl 3) fzy 4) xxa 5) xyz 6) mno 7) def 8) abc I am trying to match each of the continuous sequences ...
5 votes
2 answers
1k views
Avoiding instanceof for recursive data types
I have written a simple class hierarchy to represent terms in Scala. Terms are recursive data types, e.g., a Sum and a Multiplication consist of the left-hand-side (lhs), which is a Term, and the ...
6 votes
3 answers
3k views
Search for similar vectors, based on elementwise difference
I understand that there is a thread discussing a similar issue here: How to efficiently search a set of vectors for a vector which is the closest match But my problem is slightly different - and ...
2 votes
1 answer
128 views
F# - Associating a function with the matching type of object
Let's say I'm programming a chess game. At some point I have to check, which moves are valid for a given piece. What would be the proper way to select the correct pathfinding function for a given ...