4 ms·
Good point, and I'm not a big fan of DSL. I think most of the time, we should make a better API. But for regexes, it has been a success: they are rarely used,
by BiteCode_dev 6y ago
Good point, and I'm not a big fan of DSL. I think most of the time, we should make a better API.
But for regexes, it has been a success: they are rarely used, but when they are, you are glad you have them.
In fact you probably need to do both: re in Python is a library. A library that implements the regex DSL.
Maybe there is a way to create an API around numpy that translates a J/K/APL like DSL into numpy operations.
Just like regexes, this is not something you want to use often.
But I assume that, just like I don't want to describe a whole parser when I just need to match/split/extract text, people doing array processing probably don't want to describe every single steps for very common operations in some cases.
- Y_Y 6y agoI did exactly that a couple of years ago, turned out it wasn't hard to translate J expressions into the equivalent numpy code and then eval it in the current context. I'm afraid I've lost the code, otherwise I'd post it.