Why does Elm use && instead of "and"

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 Likes

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.

1 Like

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).

6 Likes

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

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

1 Like

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