4 ms·
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
by alexchamberlain 9y ago
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.
- icen 9y agoYes, `%` 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!
- Something1234 9y agoSo where did C get the idea to `%` for mod?
- sndean 9y agoIt 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 https://www.bell-labs.com/usr/dmr/www/btut.html
- throwaway7645 9y agoIn 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.
- RodgerTheGreat 9y agoIn APL based languages (like J), the symbol / has a strongly established history of meaning "fold", or, if you prefer, "reduce".
- feelin_googley 9y agoBut it is not a "C-based" language. It is APL-based. APL preceded C by at least eight years.