7,803 questions
0
votes
1
answer
114
views
how to avoid "borrow of moved value" with subpattern match
Edit: added a second part of the question below.
I am getting the error "borrow of moved value" here, but the thing being moved is an &mut Containee, so I didn't expect it to cause a ...
8
votes
1
answer
150
views
Primitive types in patterns: why doesn't Integer dominate byte?
JEP 455 introduced Primitive Types in Patterns, instanceof, and switch as a preview feature in JDK 23. It continues as a preview feature in JDK 24 and 25, so the feature is not detailed in the Java ...
2
votes
1
answer
56
views
Postgres not using index with varchar_pattern_ops for pattern matching query
I have a query in PostgresSQL accessing a big table using a LIKE clause for pattern matching:
Table "rmx_service_schema.document"
...
1
vote
1
answer
140
views
Pattern matching in GridDB using NewSQL
I am looking for pattern matching in GridDB using NewSQL to return values true when matched and false when not matched.
The string can start with
91 followed 33 followed by 8 digit number followed by ...
0
votes
1
answer
83
views
Transform a match to avoid duplicate
Is there a construct which allows to drop the repetition of the 0.0 routine below
val price: Option[Double] = ???
price match {
case Some(d) =>
if (isPriceFair(d))
d
else
...
1
vote
1
answer
110
views
Avoiding redundant else
class Person( id:String , age:Option[Double])
val rows: Seq[Person] = List(Person("a",None),Person("c",None),Person("e",50))
val ages = rows.foreach( r => r.age ...
-2
votes
1
answer
96
views
R: Partial matching values in a vector with partial match in df [duplicate]
I am trying to do some inventory management, I have a list of catalog numbers of materials we need and a list of managed stock onsite. I have a vector of catalog numbers (num) which are accurate to ...
1
vote
1
answer
114
views
Using pattern matching with a class that inherits from str in Python 3.10
In a parser library I maintain, I have some classes that inherit from str to manage parsed strings and parsed symbols. This has been working well for a long time, but with Python 3.10, someone ...
1
vote
1
answer
53
views
SML pattern matching on datatypes with constructors from function arguments
In the example, there is a "match redundant" Error, indicating that SOME s is matching on every string and not the provided s:
fun matchs (s : string) : (string option -> bool) =
fn x =&...
3
votes
6
answers
154
views
how to select matching rows in multiple files with AWK
I have over forty files with the following structure:
file1 first 21 lines
8191 M0
139559 M1
79 M10
1 M10007
1 M1006
1 M10123
file2 first 21 lines
8584 M0
119837 M1
72 M10
1 M10003
1 M10045
1 M1014
...
0
votes
0
answers
43
views
I can't understand variable @ subpattern in Rust [duplicate]
There is an example in the official book:
let x = 2;
match x {
e @ 1 ..= 5 => println!("got a range element {}", e),
_ => println!("anything"),
}
What's the point ...
2
votes
0
answers
86
views
Pattern matching, LIKE and wildcards
I am using Microsoft® Excel® 2019 MSO (バージョン 2504 ビルド 16.0.18730.20122) 32 ビット
and made MACRO as under
If Range(HotelCol & Row).Value Like "*" & HTLArray(HtlRmNtRow) & "*&...
3
votes
2
answers
128
views
Pattern matching for null values "AssignableTo" type?
Given a list of objects to be passed to a method with overloads, I want to determine what overload best matches the object types in order to invoke that method.
string TheMethod(string? foo, string? ...
4
votes
1
answer
191
views
Efficiently searching for a 3D pattern in a infinite array
I have access to a function bool getState(int x, int y, int z) that returns the value of a infinite 3D boolean array, conceptually shaped as [∞][4][∞]. That is, the Y dimension is limited to 4, but X ...
0
votes
2
answers
125
views
Extract StringValues first or only string with C# pattern matching
If I have a StringValues, with following possible values:
"AString"
["OnlyString"]
["FirstString", "IDontCare"]
How can I use C# pattern matching to extract a ...