Guest User

transaction_philosophy.m

a guest
Jun 30th, 2014
207
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. % An example of prolog-style logic in Mercury.
  2.  
  3. % This source file is hereby released into the public domain. (mct)
  4.  
  5. %--------------------------------------------------%
  6. :- module philosophy.
  7. %--------------------------------------------------%
  8. :- interface.
  9. %--------------------------------------------------%
  10. %--PUBLIC------------------------------------------%
  11. :- import_module io.
  12.  
  13. :- pred main(io::di, io::uo) is multi.
  14.  
  15. %--------------------------------------------------%
  16. :- implementation.
  17. %--------------------------------------------------%
  18. %--PRIVATE-----------------------------------------%
  19. :- import_module string.
  20.  
  21. %Fact Declarations
  22. :- pred philosopher(string::out) is multi.
  23.  
  24. %--------------------------------------------------%
  25. %--FACTS-------------------------------------------%
  26. philosopher("Socrates").
  27. philosopher("Aristotle").
  28. philosopher("Plato").
  29.  
  30. %--------------------------------------------------%
  31. %--METHODS-----------------------------------------%
  32. main(!IO) :-
  33. io.write_string("The following people are philosophers:\n", !IO) then
  34. (
  35. philosopher(X), io.write_string(X, !IO) then io.nl(!IO)
  36. ).
  37.  
  38. %--------------------------------------------------%
  39. %--------------------------------------------------%
RAW Paste Data