3 ms·
I used J exactly for data manipulation[2] - it was really neat even for very simple things like grouping and aggregating rows of a table (or columns). The terse
by klibertp 13y ago
I used J exactly for data manipulation[2] - it was really neat even for very simple things like grouping and aggregating rows of a table (or columns). The terseness of J makes it very well suited for interactive, incremental development; very unusual semantics of functions (monadic vs. dyadic, verbs vs. nouns vs. gerunds) make the language very composable. It's also pure - at least outside of special, implementation provided functions. And it's fast.
A typical script for reading a CSV file, manipulating it in some more or less complex way and dumping results back to file would take ~40 lines of Python (with native lists and csv module from stdlib), ~25 lines of Python with Pandas and about 5 lines of J. It obviously doesn't matter if the script is going to last for years, but if it's going to be used a few times and discarded[1], then working with J is a considerable advantage.
One thing of note, though: J is HARD. It's unlike any other language you could know and it's moderately complex. It's not that hard to pick up the basics - although my head exploded a few times before I understood how J even parses expressions - but it's entirely non-trivial to learn how the basic building blocks compose to enable you to do something useful. In my experience there's just no shortcut here - you need to start with basics and slowly work your way up. It took me a couple of weeks of learning in the evenings to get J enough to actually do something, but then it rapidly became very simple (both to do things and to learn more of J).
If you don't know any array-based language, I'd say give J a chance. Even if you won't use it itself very often, you'll learn some valuable skills, transferable to Python/Pandas or R. And if you do use it, you'll get significant boost in speed of development.
[1] Actually, J is not "write-only" language, it's just not meant to be read without the help of J environment. Reading J consists of pasting pieces of definitions into REPL and experimenting with them, and possibly using one of a few built-in ways to analyse the definition structure.
[2] Also for solving fizz-buzz: http://livescript.net/blog/fizzbuzzbazz.html#comment-1145818066 http://livescript.net/blog/fizzbuzzbazz.html#comment-1145818...