The #RosettaCode #ModularInverse task, in #ATS --
Modular inverse - Rosetta Code https://rosettacode.org/wiki/Modular_inverse#ATS
The #RosettaCode #ModularInverse task, in #ATS --
Modular inverse - Rosetta Code https://rosettacode.org/wiki/Modular_inverse#ATS
I have now added #Oberon2 --
https://rosettacode.org/wiki/Modular_inverse#Oberon-2
(UPDATE: Now with bugfix and regression test.)
Now #Fortran --
https://rosettacode.org/wiki/Modular_inverse#Fortran
Fortran provides MODULO, which is the remainder from floor division. From this one can get the floor quotient.
The Oberon-2 spec says that, for a positive divisor, DIV and MOD should give a non-negative remainder. But obc doesn’t follow that specification. (I know it’s not held to the spec, however. That’s how come I had the foresight to test it.)
Surely a language that is a lot of fun to use---here is the #Mercury ---
And my first ever program in #OwlLisp --
https://rosettacode.org/wiki/Modular_inverse#Owl_Lisp
Using a PURELY functional Scheme requires at least a small change in thinking. (Also it seems not to have unary minus sign.)