Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operator not self-explanatory 9 // 2 #1039

Closed
zzz6519003 opened this issue Aug 5, 2019 · 4 comments

Comments

@zzz6519003
Copy link

commented Aug 5, 2019

> 9 // 2

@Erudition

This comment was marked as disruptive content.

Copy link

commented Aug 9, 2019

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

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

@evancz

This comment has been minimized.

Copy link
Member

commented Aug 14, 2019

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!

@zzz6519003

This comment has been minimized.

Copy link
Author

commented Aug 21, 2019

we could remove(reserve) it

@zzz6519003 zzz6519003 closed this Aug 21, 2019

@Gabgab2003

This comment has been minimized.

Copy link

commented Aug 22, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.