-
This simple code loads fine in SWI-Prolog, but in Scryer I get eval(Operator, L, R, Result) :-
Operator == '+' -> Result is L + R;
Operator == '-' -> Result is L - R;
fail. |
Beta Was this translation helpful? Give feedback.
Answered by
pmoura
Jul 28, 2023
Replies: 2 comments 17 replies
-
The code can be simplified to the following and I still get the same error: eval(Op, R) :- Op == '+' -> R is 1 + 2; R = 0. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Standard compliant and thus more portable (also better style): eval(Operator, L, R, Result) :-
( Operator == (+) -> Result is L + R
; Operator == (-) -> Result is L - R
; fail
). |
Beta Was this translation helpful? Give feedback.
15 replies
Answer selected by
mvolkmann
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Standard compliant and thus more portable (also better style):