9 Discussion / Question Topics
Remove Filter
|
|
I am on the latest version of Windows 10, running with SWI-Prolog 7.6.4, and trying to get JPL (Java <->Prolog) running for a school project. I've not had to deal with path issues much but I have done my best to understand the problem. I've added the necessary import statements … |
|
Hi, I have an assignment. I need to write code in logic programming language SWI-Prolog. Its very hard and I am going to appreciate if you help me :D. This is the assigment: Print 2D array size of (width x height) in spiral order. More explanation and example: You have … |
|
Parser implementation Hi I am trying to implement a parser for a simple language with grammar like this. program ::= "program" declarations "begin" statements "end" declaration ::= "var" ident "as" type type ::= "string" | "int" I have the first two done, how would I write the type grammar? program( … |
|
Hi I am trying to implement a parser for a simple language with grammar like this. program ::= "program" declarations "begin" statements "end" declaration ::= "var" ident "as" type type ::= "string" | "int" I have the first two done, how would I write the type grammar? program( prog( DECLS, … |
|
Hi, I am trying to make 8-tiles problem in prolog but my code is not running . To be more specific when I type an action then I take false. So the new state is not printed. [CODE] move([0, Y, Z], [Y, 0, Z], right). move([X, 0, Z], [0, X, … |
|
at the moment I am having a problem with looping back to noun_phrase from np2. I was wondering if someone can help me loop back to nounphrase. Here is some code: noun_phrase([X|T],(det(X), NP2),Rem):- det(X), np2(T,NP2,Rem). np2([H|T],np2(adj(H),Rest),NP) :- adj(H), np2(T,Rest,Rem), noun_phrase(NP,Rem,_). I want to loop from np2 back to noun_phrase. I … |
|
i have been trying in vain to implement fibonacci in prolog, and so far i've done that in c++,javascript,python and java. but it just irritates me since i'm new to prolog and i just can't code much, because i haven't seen the prolog equivalents of c++'s for loops,if-else statements,basic variable … |
|
I am trying to find the index position of the minimum element in a list and print the element at the corresponding index position in another list. For example: [CODE] ?- min2(X,Y,[a,b,c],[5,3,7]). X= b y= 3[/CODE] Code: [CODE] min2(A,B,[A|_],[B|_]). min2(A,B,[X|T1],[Y|T2]) :- smallest(W,[Y|T2]), % using a predicate to find the min … |
|
I have a code in here [CODE=prolog] location(california, usa). location('los angeles', california). location(hollywood, 'los angeles'). look_on(Country,Place) :- location(Place,X),write(X),nl, look_on(Country,X), fail.[/CODE] if i query like this one [CODE=prolog]-?look_on(Place,stamp).[/CODE] the output would be: los angeles californai usa ,can anyone help me how to display only the the last data which is the … |
The End.