in Prolog you write rules about how the world works.
Then you make queries about the rules
The rules go in a file.
The querie goes in at the ?- prompt
You're typing the rules in there.
See
http://www.pathwayslms.com/swipltuts/student/index.html#hello
and
http://www.pathwayslms.com/swipltuts/student/index.html#not_repl
________________________________
From: Julio Di Egidio <
ju...@diegidio.name>
To: SWI-Prolog <
swi-p...@googlegroups.com>
Cc:
ali.dur...@gmail.com
Sent: Thursday, July 23, 2015 7:02 AM
Subject: [SWIPL] Re: please help me what should I do (prolog)
On Thursday, July 23, 2015 at 2:27:50 PM UTC+1, ali durgun wrote:
<snip>
I'm still getting this type of errors getting annoyed. What should I do ?
You are using the very same code to define a predicate then to query it: that cannot work, can it?
Here is a working example:
?-[user].
|:my_write(L):-member(X,L),write(X),nl,fail.
|:
%user://1 compiled 0.00 sec, 2 clauses
true.
?-my_write([1,2,3]).
1
2
3
false.
?-
I'd suggest you go through some Prolog *tutorial*, there are plenty online.
HTH,
Julio
--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
swi-prolog+...@googlegroups.com.
Visit this group at
http://groups.google.com/group/swi-prolog.
For more options, visit
https://groups.google.com/d/optout.