Copyright © 2024 SingChun Lee Bucknell University. All rights reserved. Sites developed using revealjs.
Prolog | Others such as Java | |
---|---|---|
Atom/Idea (Constant) | abc | ABC |
Variable | UpperCase | camelCase |
Rule/Function | foo(stuff, return):- body. | foo(stuff { body; return value; } |
Fact | foo(stuff, return). | See above |
Query/Function Call | foo(Variables) | foo(variables); |
write(X):= "Magic built-in code that prints X". % This returns true
write(false). % it prints "false" and returns true
rule().
rule(..):= ... % runs them in order: from top to bottom
rule(..):- ... % keeps the 1st one to return true