Re: Four Easy Question
From: Benjamin Johnston (superhero_at_benjaminjohnston.com.au)
Date: 03/22/04
- Previous message: Nick Wedd: "Re: Sublists question"
- In reply to: Linux Man: "Re: Four Easy Question"
- Next in thread: Linux Man: "Re: Four Easy Question"
- Reply: Linux Man: "Re: Four Easy Question"
- Reply: Benjamin Johnston: "Re: Four Easy Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Nick Wedd: "Re: Sublists question"
- In reply to: Linux Man: "Re: Four Easy Question"
- Next in thread: Linux Man: "Re: Four Easy Question"
- Reply: Linux Man: "Re: Four Easy Question"
- Reply: Benjamin Johnston: "Re: Four Easy Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]