3 ms·
Come now, every time a colleague says they parsed a file with a regex in javascript, do you turn to them and tell them "well, you didn't actually use a _regular
by johnfn 3y ago
Come now, every time a colleague says they parsed a file with a regex in javascript, do you turn to them and tell them "well, you didn't actually use a _regular_ expression..."
- unhammer 3y agoOnly every time they claim a major mathematical breakthrough using regular expressions.
- underdeserver 3y agoNobody claimed that.
- SerpentJoe 3y agoIt's true, the article doesn't make that claim. We think of primes as being mysterious and out of reach, and we're conditioned to think "mathematical / computational breakthrough" when we read the words "prime number" in a headline, but this is only because we've found all of them that aren't huge enough to be mysterious. Computing prime numbers is trivial as long as you don't mind them being the same ones everybody else already found.
- Tainnor 3y agoNot sure what you mean by "trivial", I mean a simple prime finding algorithm is easy to write down, but it will be very inefficient, especially for large primes (the very ones you use in cryptography). Coming up with an efficient prime-finding algorithm like Miller-Rabin* is far from trivial. * Technically it's just a prime-checking algorithm, but you can just generate random numbers until you've verified one of them is prime.
- Tade0 3y agoI do find it useful to know that regular expressions in JS(and many other languages really) are not actually regular and why - allows one to decide if a given problem can be solved at all using them.