Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Calculating Burn Rates in J (hillelwayne.com)
74 points by sndean on Dec 10, 2017 | hide | past | favorite | 12 comments


Just to clarify: % is integer division in J? In C based languages it's modulus. Whilst having diversity of language is great, it feels odd to choose to make an operator mean something opposite.


In J every symbol is precious and extremely well thought out. The ancestor language "APL" uses its own custom symbols where there the traditional Unicode looking division symbol is used. I really like the APL symbols (there's a video of a guy using the special APL typewriter from the 60s on YouTube), but with J you don't have to worry about installing a special font and buying a keyboard with the symbols written on the right keys. J doesn't precede C in age, but the author/architect (Turing award winner Ken Iverson) had been making large contributions to computing well before C, so he would've had no reason to think "let's make sure as many of my symbols follow C as possible". APL and its descendents are used in industry and have been for decades. Primarily in finance (see KxSystem's awesome KDB+ used by many such as Morgan Stanley), but also in places like Volvo...etc.

Edit: I just re-read my comment and I hope it didn't sound too condescending (not my intent). I'm fairly new to J, but it's pretty cool and I hope you give it a shot if you ever need to do any data oriented tasks.


Yes, `%` is division. It's not that odd, if you look at the symbol - it looks quite similar to the division symbol `÷`.

It's almost better asking where C got the idea that it should be mod from!


So where did C get the idea to `%` for mod?


It looks like % has a different use in BCPL, but it's used for mod in B [0], so I'm guessing it's a Thompson/Ritchie invention? (unless it came from some other language that came before B)

[0] https://www.bell-labs.com/usr/dmr/www/btut.html


In APL based languages (like J), the symbol / has a strongly established history of meaning "fold", or, if you prefer, "reduce".


But it is not a "C-based" language. It is APL-based. APL preceded C by at least eight years.


I naively thought it was about calculating energy expenditure in Joules.


> It’s a sort of hybrid of a general purpose language and a DSL. Let’s call it a Specific Purpose Language, where the purpose in this case is “doing stuff to numbers”

While I do appreciate and like both APL and J, I wonder why the author does not (or does he?) use Python + Pandas for this type of calculations.


I've used Pandas a bit and it certainly works well, but there are a lot of library functions to learn while J seems to basically be learn the two uses for every symbol and know how to do all math stuff ;).

I'm always impressed to see derivative and both matrix inversion & transpose as elementary operations instead of googling for a library that is most likely poorly documented. Furthermore, since the vector is the basic data type, things like matrices crop up a lot more in J & APL. In Python they are for scientific pursuits. In J they will often crop up even if you're writing a blackjack game. I think this is why it doesn't appeal to many programmers without a strong mathematics background, but it's very appealing to those who have that kind of background and grow tired of writing incessant loops.


In all honesty it's more a comfort thing: I'm so used to vanilla Python that the extra stuff in Pandas messes with my head. It's just easier for me to work in a completely different language.

Also J is more fun as a puzzle language, so I use it for personal projects. If I was writing stuff for production I'd probably (if begrudgingly) use Pandas instead.


Is that J an outlook-smiley?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: