How to work with lists in Prolog?

The guys who worked with the prologue ? Show me how it works.

There is such task :
* In the list of symbols S1, S2, ..., Sn, find all occurrences of a specified word, if the separator between words is one or more spaces.

Where did you get that code
count(X,X,1):-!. 
count(_,Y,0):-atomic(Y),!. 
count(X,Y,N):- 
 Y=..[_|Subs], 
 count_list(X,Subs,N). 
count_list(_,[],0):-!. 
count_list(X,[H|T],N):- 
 count(X,H,N1), 
 count_list(X,T,N2), 
 N is N1+N2. 

start-phony(S),read(Sl),count_list(Sl,S,N),write('N = '),write(N).


So, as you can run it? What to write in the query panel ?
June 10th 19 at 15:03
0 answer

Find more questions by tags Prolog