Why does Elm use && instead of "and"


#1

Elm strives to be so readable, so I don’t get why it uses the C like “&&” and “||”. Anyone knows? Just a preference by Evan? Or a parser issue? Or something functional languages do?

I’m from an Eiffel background and find this is a bit baffling.


#2

Was thinking about this myself, especially since not is a keyword and not an operator. Python’s logical operators and, or and not just feels more natural.


#3

It’s because the syntax only allows operators for infix names. Otherwise it would be hard to know what is the function and what are the arguments. You could of course make new keywords for and and or and treat them differently.

not is a regular prefix function, and operators are not allowed in prefix form (except for - which is special).


#4

I’ve just tried to imagine having minus instead of -

minus 1 + ( 3 minus <| List.length list ) :smiley:


closed #5

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.