Priority for the "div" operation

Help
Sylvain
2012-01-09
2013-05-30
  • Sylvain

    Sylvain - 2012-01-09

    Hi,

    I have run into an apparently unlogical priority for the "div" operation: "X div Y + Z" is evaluated as "X div (Y+Z)" in the scala wrapper for JaCoP. I had to write it "(X div Y) + Z" to get the expected result. Is this behaviour normal?
    Regards

    Sylvain

     
  • kris

    kris - 2012-01-09

    Hi,

    Yes, I know this but I do not know how to define priorities for overloaded operators in Scala. I think, it is not possible in the same way as it is possible in Prolog, for example. You need to use parenthesis. Sorry.

    Please, let me know if you will find a way to do it ;)

    Best regards,
    /Kris

     
  • kris

    kris - 2012-01-09

    Hi again,

    The other explanation is the way Scala interprets space in the statement "X div Y + Z". It is, in fact, another way of writing "X.div(Y.+(Z))" and this probably explains everything.

    /Kris

     
  • Sylvain

    Sylvain - 2012-01-09

    Yes, it is indeed a good and simple explanation. :-) Thanks.

    Sylvain

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks