[Haskell-cafe] Difference between div and /
ok at cs.otago.ac.nz
Tue Jun 1 22:01:19 EDT 2010
On Jun 2, 2010, at 9:18 AM, Maciej Piechotka wrote:
> Hmm. C, Java & co. seems to not have this problem.
Languages that do recognise a difference between
integer quotient-and-remainder and multiplicative inverse:
- Algol 60, Algol W, Algol 68
- BCPL (/ is integer division, #/ is float division)
- Simula 67
- O'CAML (/ is integer division, /. is float division)
- Prolog (/ is float division, // is integer division)
- Erlang (/ is float division, // is integer division)
- Pascal (/ float, div integer)
- Common Lisp
- Mathematica (x/y -vs- Quotient[x,y])
> Also having common division operator is well - useful.
I would like to see some evidence for this.
The confusion goes back to Fortran, and was marginally
excusable back when 48 characters was considered enough
in a character set. (PL/I was also designed to work in
an alphabet of 48 characters; the Algols were not.)
> I don't think it would create much confusion. At least no more than
>  By co I mean Ruby, Python, Perl and others. There are no so many
> languages that do recognize the difference.
We can put it another way: C-like languages have so *many* problems
that this particular one does not stand out.
For what applications is it "useful" to use the same symbol
for operations obeying (or in the case of floating point
operations, *approximating* operations obeying) distinct laws?
More information about the Haskell-Cafe