[m-users.] Idiomatic Mercury - if-then-else or (C->I;E)
Mark Brown
mark at mercurylang.org
Mon Nov 23 15:08:11 AEDT 2015
On Mon, Nov 23, 2015 at 11:52 AM, Richard A. O'Keefe <ok at cs.otago.ac.nz> wrote:
> While both Prolog and Mercury let you write long
> conditions, it isn't a good idea to do so, whatever
> tokens you use for marking the syntax.
Agreed. If that were in the coding standards, which perhaps it ought
to be, that would have avoided my main concern.
>>
>> Other reasons include that it looks like implication, which it's not,
>
> No, it looks like a McCarthy M-expr conditional,
> except for round parentheses instead of square brackets.
> Implication, when used in Prolog, used => not -> .
> Backus used this syntax in FP, see page number 620
> in https://www.cs.cmu.edu/~crary/819-f09/Backus78.pdf
I must confess that, as a newbie Prolog programmer, this was not my
first hypothesis. :-(
To a Scala programmer, => looks like case selection not implication.
So I'd like to add another reason for using if-then-else, which is
that across programming languages it is used much more consistently
than any kind of arrow.
Mark
More information about the users
mailing list