The + character

Help
Ted Kosan
2013-04-24
2013-04-25
  • Ted Kosan

    Ted Kosan - 2013-04-24

    I am interested in using code that is similar to the following:

    ?- Expression =.. [+, 2, 3].
    Expression = 2+3
    (From “The Prolog Dictionary” http://www.cse.unsw.edu.au/~billw/prologdict.html#univ)
    

    In JLog, this code does not work with the + character:

    Expression =.. [+, 2, 3].
    SYNTAX ERROR:
    ubc.cs.JLog.Parser.SyntaxErrorException: Expected ']' at 20 : line,char(1, 20)
    

    However, it works with the * character:

    Expression =.. [*, 2, 3].
    =..(Expression, [*, 2, 3])
    Expression = 2 * 3
    yes
    

    The code with the + character also works in SWI-Prolog and JIProlog.

    Is the code that uses the + character supposed to work in JLog?

     
  • Glendon Holst

    Glendon Holst - 2013-04-25

    I'm afraid this is a known bug:

    http://sourceforge.net/p/jlogic/bugs/16/

    Putting operators in parenthesis (e.g., X =.. [(+),2,3].) should work around the issue.

     

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

Sign up for the SourceForge newsletter:





No, thanks