Then you see "<^<()(?R){2}>\z|\1\Q^<()(?R){2}>\z|\1\Q>", and you can't even begin to parse it. For one, I didn't know you could add a quantifier to a recursive pattern. Then there is a backreference to what appears to be an empty capture, which is part of an alternation for fuck's sake, which also happens to include the \Q notation.
I imagine I am in the top 20-30% of regular expression users. And I straight up do not understand a single aspect of how this expression manages to match anything, let alone its intended purpose.
It doesn't matter how this regex was found. Whether it was obtained through an entirely manual process or assisted by some kind of AI, it's beyond incredible. 99.9999xxx% of senior software developers who have been programming for 30+ years could not come up with this if they were given 10 years to try and discover it out without 3rd party assistance.
>> These are smart people of course, but it's easy to get overly impressed
How bloody arrogant, and frankly a bullshit statement from someone who has no idea what they are talking about. This is amazing. Someone would have to sit down with me for at least a week - probably 3+ months - to even begin to explain to me exactly how this works.
Why did I take this comment so personally? I don't know, it sounds like the parent has never even seen a regular expression, and yet is trying to promote their own sense of worth as if they're a genius when in fact they have an IQ of 40. That somehow the people who managed to figure this out are only lucky to have done so, rather than there being any significant time or skill involved. I bet you there are less than a thousand human beings on Earth who could have solved this. It's likely that the people who fucking designed and wrote PCRE could not have even solved this.
Basically, stfu. Why do you have to comment only to diminish someone else's success story? You couldn't have solved this, so don't even try to minimize the achievements of others.
Everybody is a Genius. But if you judge a fish by
its ability to climb a tree, it will live its whole
life believing that it is stupid.
- Albert EinsteinAlso no evidence that Einstein said it. Indeed he seems to contradict the general idea behind it.
Not everyone is a genius. Being amazing at woodwork or running is not "genius", it's admirable but different. Some people are [intellectual/intelligent] geniuses, period. Not everyone is.
The best way to take this aphorism IMO is "don't stress out if you're a fish and you're no good at climbing trees, if your thing is swimming that's good too".
"To understand monads, you first need to understand monads."
They are an abstraction, effectful computation is not inherent to them, they represent computational contexts, e.g. the list monad is used to model non-determinism, the maybe monad represents computations that can fail, both of these are pure.
This is an excellent set of posts for building an intuition about monads: http://mvanier.livejournal.com/3917.html
See this is the kind of thing that made learning Haskell so hard for me. I'm not a math guy, I'm terrible at math. I have no idea what "non-determinism" means, and I'd venture to guess that list monad is used to model "ordered collections of things".
But the idea of a list also suggests an ordering to me.
I'm fairly certain that in this context, non-determinism means that there can be more than one answer/result.
If you have a `Stream<Deck> decks;` of card decks, and want to get all the cards from all the decks, you might try to do something like `decks.map(deck -> deck.getCards().stream())`, but that will give you the type `Stream<Stream<Deck>>`. That sucks, we just want a single stream, not a stream of streams, so we call the function that flattens at the same time. `decks.flatMap(deck -> deck.getCards().stream())`.
Nondeterminism is just a standard use for this construction: given one choice, generate more choices, given that choice, generate more choices, do some computation with the choices, and then return the list of possible final results.
Perhaps their talent is actually just an attraction to studying it really hard. I, for instance, do not have the patience to study regex so much as to ever get the point where I could easily answer this question.