"%%" and "%/%" for the remainder and the quotient
r
Solution
In R, you can assign your own operators using `%[characters]%`. A trivial example:
'%p%' <- function(x, y){x^2 + y}
2 %p% 3 # result: 7
While I agree with BlueTrin that `%%` is pretty standard, I have a suspicion `%/%` may have something to do with the sort of operator definitions I showed above - perhaps it was easier to implement, and makes sense: `%/%` means do a special sort of division (integer division)
Problem
I am wondering how and why the operator `%%` and `%/%` are for the remainder and the quotient. Is there any reason or history that R developer had given them the meaning they have? ``` > 0 %/% 10 [1] 0 > 30 %% 10 [1] 0 > 35 %/% 10 [1] 3 > 35 %% 10 [1] 5 ```