prolog

Real world Prolog usage

Many study Prolog in college, but I have personally not come in contact with it professionally. The traditional examples given are AI and expert system applications, but what have you used it for and what made Prolog a suitable language for the task? ...

Should LOGIC-techniques be blended into Mainstream Programming?

I refer specifically to predicate logic, somewhat as implemented in PROLOG, but less strictly bound to first-order logic. PROLOG-techniques offers powerful solutions towards data-analysis, data-mining, problem-solving, etc., but PROLOG's reputation as an exotic toy for AI, expert-systems and research seems to prevent the application of ...

Integrating Prolog with C#

Does anyone know of a nice (and preferably free) way to integrate Prolog and C#? Im looking to create a Prolog dll or similar to call from my managed code, and retrieve an answer once all the processing has been complete. Im looking for it to be predominantly one sided (c# calls Prolog). I have seen this question which talks about Prol...

What problems are best solved with Logic Programming?

By Logic Programming I mean the a sub-paradigm of declarative programming languages. Don't confuse this question with "What problems can you solve with if-then-else?" A language like Prolog is very fascinating, and it's worth learning for the sake of learning, but I have to wonder what class of real-world problems is best expressed and...

Without creating a list, how can I query the integers between two values in Prolog?

For example, if I make a query like 'between(1,4,X)?' I would expect something like X=2,X=3. Is this possible? ...

What's a good Prolog IDE for Linux?

I need to write some Prolog programs for a class. Any recommendations? ...

Trailing variable in a prolog list.

Hi folks, I'm on a beginner level course in prolog, doing a map colouring problem. Here's my code. col(Colors,Map,Coloring) :- checkMap(Colors,Map,Coloring). checkMap(Colors,[Country1:Country2],Coloring) :- goodColor(Country1:Country2,Coloring,Colors). checkMap(Colors,[Country1:Country2|Rest],Coloring) :- goodColor(Country1:...

Prolog: Filtering a list?

Hello! I'm currently working on a very short project on Prolog, and just got stuck trying to apply a "filter" I have created to a list. I have what you could call the filter ready, but I can't apply it. It'd be better if I illustrate: filter(A, B) ...outputs 'true' if certain conditions are met. filterList(A, [X, Y, Z]) ...outputs ...

prolog recursively find largest node

Just a simple binary tree and i want to find the the largest node. example tree: t(t(t(nil,1,nil),2,t(nil,3,nil)),4,t(t(t(nil,8,nil),5,nil),6,t(nil,7,nil))) int L(t,max) { if(t=null) return max; if(max<t.root) max = t.root; LN(t,max); RN(t,max); return max; } L(tree,tree.root); I just cant wrap my head around applying it to prolog. He...

How to verify if a rule exists in a prolog file clause database

I'm working on a college assignment where I must verify if a certain clause (as a fact or as a rule) exists in the current clause database. The idea is to use a rule whose head is verify(+name, +arguments). This rule should be true if in the database exists another rule whose head is name(arguments) Any help would be greatly appreciat...

Passing results in prolog.

I'm trying to make a function that has a list of lists, it multiplies the sum of the inner list with the outer list. So far i can sum a list, i've made a function sumlist([1..n],X) that will return X = (result). But i cannot get another function to usefully work with that function, i've tried both is and = to no avail. ...

Prolog - outputting a list?

I have the function sublist(_,[_],_):-!. sublist(X,[Y|T],Z):- R is X - Y, sublist(X,T,[R|Z]). an example call is sublist(2,[1,2,3],Z). At the end of execution it just gives me 'yes', but i'd like to see the contents of Z. I know it's something simple as i have other instructions that do similar things, but this one isn't working. ...

Good beginners material on Prolog

I am looking for good beginners material on Prolog, both online and printed. I am not only interested in 'learning the language' but also in background and scientific information. ...

Logical Languages - Prolog or Lisp/Smalltalk or something else?

So, I am writing some sort of a statistics program (actually I am redesign it to something more elegant) and I though I should use a language that was created for that kind of stuff (dealing with huge data of stats, connections between them and some short of genetic/neural programming). To tell you the truth, I just want an excuse to d...

What should return from a disjunction with independent variables?

What would result from something like the following: p(X,Y) :- q(X). p(X,Y) :- r(Y). q(a). r(b). I don't have a Prolog compiler handy, so I can't test what would happen if you then asked p(X,Y). Would the code even compile? Would p return two answers, each with one of the variables unbound? In a real world scenario, I don't think p...

Normalizing space characters in Prolog atoms

What is the best way to normalize whitespace characters (space, newline, tab) in a Prolog atom, e.g. in SWI-Prolog. I.e. I would like to have a rule: normalize_space_in_atom(+Atom1, -Atom2) such that Atom2 has any sequence of whitespace characters turned into a single space starts with a non-space ends with a non-space ...

Converting a list into a term in Prolog

What is the best way of converting a Prolog list into a Prolog term (that is not a list), in terms of efficiency, and using existing built-in predicates as much as possible? The interface and usage examples would be the following. %% list_to_term(+List:list, +Functor:atom, -Term:term) % % Usage: % % ?- list_to_term([], myfunctor, Term)...

Why hasn't logic programming caught on?

As time goes by, it appears more and more like functional programming is having more of an effect on other programming languages. We're starting on Prolog in my AI class, and it seems like there are some things there that would make programming in non-AI fields easier. My question is this: why hasn't logic programming caught on in the...

How to change prompt_alternatives_on flag in prolog from .plrc?

I can change prompt_alternatives_on flag in the REPL. But how do I change this flag in .plrc? Then I get permission to modify static_procedure `set_prolog_flag/2' Goal: To not get the "More?" text for all the answers all the time. By changing the flag. ...

Prolog ECLiPSe - how to implement yield method?

i'm using ECLiPSe programming logic system. i want to implement the yield method for passing the values from prolog to C/C++. Has anyone implemented it? Are there any other ways for passing the values? ...