← Back to context

Comment by eigenvalue

1 year ago

This language is very popular among quant finance people associated with Morgan Stanley. I don’t see the appeal myself. Maybe it helps prevent people stealing the code since it’s so awful looking to work with! At one point I had to learn it and I think I’ve totally forgotten it now— it’s like my brain repressed it. Not my cup of tea, that’s for sure.

Thinking about problems and data manipulation in the way array languages enable is hard but, once you have pushed through the what feels like a barrier of mainstream programming language thinking that is stopping you from “grokking” it, it is a sudden moment of clarity and then you “get it”.

Perhaps a half way house is sql. The difference between ORM-style CRUD and a power user using window functions to make the data dance shows there is still art to be had in programming :)

  • Agreed. Pushing through until you can think in array languages is well worth it! In my experience one of the top 30 highest ROI mental circuits you can develop.

    That being said, I'm not convinced that the extremely minimal syntax is essential. I think it can be done another way ;)

    • I started with J but now prefer K and I'm writing an interpreter for a K-like language in my spare time for fun.

      I'd say the minimal syntax isn't just a gimmick, because it really does help with mentally chunking phrases/idioms to a degree that's not possible when the same phrases are multiple lines long. Terseness also makes it physically faster to write the same thing, which encourages interactive experimentation much more than other languages.

      These are small things, but taken together you get an experience that's more than the sum of its parts.

      A lot of folks seem to tolerate K syntax because K jobs pay well. (Supposedly. I've never seen a super-high paying K job in real life.) But I actually like the K syntax because it helps organize my problem solving, and it gets out of the way during experimentation time. To me it's like NumPy/Pandas but better designed and without all the ceremonial boilerplate.

      3 replies →

Most people I know who actually learn an array language like k or j usually grow to appreciate the expressiveness and cleverness of these languages. Typically, people have your reaction who have only looked at it and tried it very briefly. I'm surprised. Why did you have to learn it? Where?

  • Was working at a quant pod at Millennium for a bit where they used it. I was ultimately able to use it but everything took me 20x longer than using Numpy/Pandas. The irony was that the Python code was shorter because there were so many more library functions and better abstractions and syntax. So it was slow and unintuitive for zero benefit whatsoever.

    • Geometric mean in Numpy vs. J:

      (Copied from some forum, since I don't use Python much)

        import numpy as np
      
        def geo_mean_overflow(iterable):
            return
      
        np.exp(np.log(iterable).mean())
      

      Or,

        from statistics import.
        geometric_mean
      
        geometric_mean([1.0, 0.00001, 10000000000.]) # 46.415888336127786
      

      In J, since I don't know K:

        gm=:#%:*/
      
      

      Even shorter than Python whether it's a canned lib routine or created from composing simple functions.

      And I don't need to format code on HN in J because it's so short anyway, besides I don't know how!

    • But how did your perf compare to the best of the K kicking quants around you? Were they too being less productive than they would have been in python?

      I’m not saying they were right or better. Horses of courses. Array languages do my head in and my choice is sql.

      4 replies →