Re: Four Easy Question

From: Benjamin Johnston (superhero_at_benjaminjohnston.com.au)
Date: 03/22/04

  • Next message: Matthew Huntbach: "Re: Mainstreaming Prolog a Pragmatic Approach?"
    Date: Mon, 22 Mar 2004 21:47:58 +1000
    
    

    "Linux Man" <steven_82m@hotmail.com> wrote in message
    news:150a16c6.0403211042.1b3c0612@posting.google.com...
    > Hi again
    >
    > I'm using SWI-Prolog

    > 1- How can I create a file in prolog?

    At the SWI-Prolog console type:
    help(open).

    > 2- How can I read from a file or check that, say
    > "john is father of bob" (father(john, bob)), from
    > that file?

    At the SWI-Prolog console type:
    help(consult).
    or
    help(read).
    or
    help(read_file_to_codes).
    or
    help(read_file_to_terms).
    or
    help(read_line_to_codes).

    For other ways of reading, type:
    apropos(read).

    > 3- How can I write a new predicate in the created
    > file (e.g. father(jim, alice).)?

    At the SWI-Prolog console type:
    help(write).

    (use write/2, i.e., write(Term, Stream)).

    Does that answer your question?

    -Benjamin Johnston


  • Next message: Matthew Huntbach: "Re: Mainstreaming Prolog a Pragmatic Approach?"