Is there something like a regexp-language, except generalized to sequences of objects? I want to be able to express patterns of properties in a list, and find matches in a way that isn't if((foo(i j) && bar(i j 1) && baz(i j 2)) || foo(i j) && ...
3 years ago 路 馃憤 aka_dude
@aka_dude Yeah, something like that. I'm specifically looking for a way of expressing a matcher against repeating patterns (like, with regexps), but matching against object properties. Basically, if you generalize regexps from character traits to object traits 路 3 years ago
I see you want to match on Java objects. Maybe one could create something handy like monadic parser in Java, too 路 3 years ago
Is this just parsing? Parser is something that takes stream of symbols (of any kind) and either returns an error or parsed object. In purely functional languages like Haskell parsing looks very nice (see monadic parsers, e.g. Megaparsec)
This "symbols" may not be characters/bytes, anything works 路 3 years ago
My bad, 636 is the tutorial, it was 622/634. https://www.python.org/dev/peps/pep-0636/ 路 3 years ago
https://www.python.org/dev/peps/pep-0636/
Use a language with ML-style pattern matching. Python now supports this thanks to PEP 636. 路 3 years ago
Perl/Raku 路 3 years ago
No these are objects, like Java-objects, not strings. If they were strings I could just use regexp. I don't want to have to serialize them down to strings just so I can find repetitions :-( 路 3 years ago
XPath/XQuery or jq? Assuming you can feed your list as XML or JSON. Or maybe encode your list as text and actually use regexps? 路 3 years ago
(also, explicit state machines are an implicit surrender to the problem of finding a good abstraction) 路 3 years ago