Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - % An example of prolog-style logic in Mercury.
 - % This source file is hereby released into the public domain. (mct)
 - %--------------------------------------------------%
 - :- module philosophy.
 - %--------------------------------------------------%
 - :- interface.
 - %--------------------------------------------------%
 - %--PUBLIC------------------------------------------%
 - :- import_module io.
 - :- pred main(io::di, io::uo) is multi.
 - %--------------------------------------------------%
 - :- implementation.
 - %--------------------------------------------------%
 - %--PRIVATE-----------------------------------------%
 - :- import_module string.
 - %Fact Declarations
 - :- pred philosopher(string::out) is multi.
 - %--------------------------------------------------%
 - %--FACTS-------------------------------------------%
 - philosopher("Socrates").
 - philosopher("Aristotle").
 - philosopher("Plato").
 - %--------------------------------------------------%
 - %--METHODS-----------------------------------------%
 - main(!IO) :-
 - io.write_string("The following people are philosophers:\n", !IO) then
 - (
 - philosopher(X), io.write_string(X, !IO) then io.nl(!IO)
 - ).
 - %--------------------------------------------------%
 - %--------------------------------------------------%
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment