# Prolog implementation of SEND + MORE = MONEY isn't finding a result

I’m getting started with Prolog, and decided to try the famous SEND+MORE=MONEY puzzle, as it seemed fairly straightforward. However, my implementation does find a result. Can anyone see what I did wrong? smm([S, E, N, D, M, O, R, Y]) :- maplist(between(0, 9), [S, E, N, D, M, O, R, Y]), Line1 is S*1000 +… Read More Prolog implementation of SEND + MORE = MONEY isn't finding a result

# Defining a predicate as substitute for =/2 in Prolog

For my programming course’s assignment, I have to write some Prolog code without using any pre-defined predicates (excluding , and ;), but saw no way around using =, as I had to check whether a variable A is equal to (can be identified with) some foo(B, C). Since this isn’t allowed though, I’d like to… Read More Defining a predicate as substitute for =/2 in Prolog

# Why is this code in PROLOG giving me a syntax error?

col_tri(Vars):- Vars=[X1,X2,X3], Vars in 1..3, X1#\=X2, X1#\=X3, X2#\=X3, label(Vars). This code is giving me this error in line 2 (Vars in 1..3,): ERROR: c:/users/xxxx/desktop/prolog/tp2.pl:2:20: Syntax error: Operator expected >Solution : Operators are things like the + in 1 + 1, and in your code the in in Vars in 1..3. Prolog code can define new… Read More Why is this code in PROLOG giving me a syntax error?