Core: operator not self-explanatory 9 // 2

Created on 5 Aug 2019  路  4Comments  路  Source: elm/core

> 9 // 2

Most helpful comment

Hey, can you say a bit more about how you came across this operator? Is there something that could be added that would make it easier? Perhaps in the documentation or elsewhere.

A lot of documentation is available on https://package.elm-lang.org/ but I know that that the notes about this operator here are really hard to find unless you know were to look!

Please let me know more about your situation so we can try to think of ways to make it less confusing!

All 4 comments

...um, that's why it's in the docs?

(//) : Int -> Int -> Int
Integer division:
3 // 2 == 1
Notice that the remainder is discarded.

Hey, can you say a bit more about how you came across this operator? Is there something that could be added that would make it easier? Perhaps in the documentation or elsewhere.

A lot of documentation is available on https://package.elm-lang.org/ but I know that that the notes about this operator here are really hard to find unless you know were to look!

Please let me know more about your situation so we can try to think of ways to make it less confusing!

we could remove(reserve) it

As another user whose comment has been removed said. The // operator is in the docs. But you have a point. Unlike the / operator which every kid learns in school // is not taught in school because its not general. But if we follow that logic we would have to remove ^ as exponent as in school we learn that superscript is the way to annotate exponents. The // operator has its roots in python as far as I know and most people know it from python. Integer dividing is important in the Web for styling things, so making the operator longer wouldn't be great as it would add unnecessary complexity. In Morse for example the e is a single dit (.), because it is used often. If the e were let's say dit dit dah dit (..-.) it would be slow to Morse. Same applies to programming language. Verbose features tend to be used less/only if needed. Elm language design respects that

Was this page helpful?
0 / 5 - 0 ratings