11

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 these techniques as mainstream programming tools.

Yet, these techniques allows you to capture in a few lines of code functionality that would typically be implemented over many functions or classes.

I want to seamless integrate the techniques with the existing language (currently using C++).

I'm investigating the application and use of these techniques as part of general programming constructs. I am focusing on making the techniques available in such a way that minimizes the use of recursion, does away with the proneness to endless-looping, and provides its solutions in a single pass. I already have a working proof-of-concept implementation. (PROLOG itself can be seen as a specialization of it, and it is able to execute almost any PROLOG program)

Some of the techniques/applications I am refering to:

  • use predicate-logic;
  • implement expert-systems (without all the code!);
  • (re)structuring or directly use the data to facilitate discovery;
  • using sequential datasets directly in analysis ('the data becomes the code');
  • more robust error-handling;
  • ...

I need to know if having these techniques available as an integrated part of your normal programming language would be generally useful. If so, I want to create an open-source project for it.

7

SWI-Prolog has a C native interface, you can use it to make it interoperate with C applications pretty seamlessly. I believe this could be valid for C++ applications then, but my knowledge of the C/C++ world is not sufficient.

As I have mentioned earlier before, there exist attempts at integration of Prolog and Java, and they seem to advance pretty well.

I am not sure I have understood your question entirely. You are trying to create some sort of C++-Library to work similar to Prolog? Or is it a preprocessor? An entirely new language that can use C++ libraries?

If it is the latter, don't bother, I think the native interface of SWI handles this just fine. A preprocessor/macro system would not be used a lot by C++ pogrammers, it reeks of Lisp :-). A native library might be of some use, but I believe it would be hard to implement efficiently, and again, Prolog programmers would prefer to use the native interface.

C++ programmers, on the other side, are put off by many things about Prolog. It's got a reputation of being inefficient, it is dynamically typed, it is based on recursion, choice points are confusing, to really master Prolog, you should understand the WAM, Prolog's minimalist syntax seems to discomfort a lot of people, and last but not least, it's a whole different Paradigm.

In order for you to implement any decent subset of Prolog, you should (re-)implement the WAM, too. And, honestly, I doubt this will bring anybody to the world of logic programming. LP is just too weird, from a mainstream point of view, because nothing that is remotely like it is really subject of CS educations. If at all, a few enthusiastic students deal with it and then when they don't use it in the industy, they forget it. Prolog's main scarepoint is the paradigm it uses, and it's heritage and history.

There exist several attempts at providing other languages for Logic Programming, and there are a number of languages using the paradigm. Maybe one day one of them will take off as the Next Big Thing. I clearly hope so, because that would increase my chances on the job market.

5

Does it solve a problem?

In general, I'd say that whether or not a particular language, tool, or framework can be useful really just depends on whether or not you have a valuable application for it. It's also true that new languages and tools need time to mature, and more time to find acceptance. It's not just reputation that keeps PROLOG out of the mainstream- it's also about whether or not there is a market for PROLOG developers, and whether or not the benefits that you attributed to PROLOG would be cost-effective to adopt. You're absolutely right about being able to express certain types of problems more effectively in PROLOG. As a programmer, I place a lot of personal value on that sort of thing. But if I can find 100 Java developers for every one good PROLOG jockey, and my recruiters are already going through 200 resumes before they find one Java developer that we'll even interview, then that programmatic elegance is a hard sell.

Give it a shot

If you try to develop a language or framework without a specific application or functional context in mind, you won't be adding value when you make design decisions. I'd encourage you to continue to develop your idea, keeping in mind a specific use case, which it will help you to create better than the tools you currently have available. If it provides a unique solution to a common problem, it will be valuable and worthwhile. If it doesn't work out as you expect, you'll still have learned a lot from working through it. You'll always be rewarded by the successes and the failures of your efforts, and your idea may turn out to be a good contribution to software.

If you get on google code or sourceforge, you can have an open source project up and running today.

4

I learnt some Prolog in college and knew it was sometimes used in industry, including inside Windows NT. But I could never see the point.

But once I started using XSLT in earnest I became aware of the benefits of 'push based' approaches to problems. I've been meaning to dust off the old college texts but more urgent stuff keeps getting in the way. So anything that made that type of coding in Java/C# more accessible would be interesting (to me at least).

1

I have a little experience with Prolog from a taught course and some time spent building a few TurboProlog (now VisualProlog) shareware systems - largely as an exercise.

There possibly is a place for this - certainly the Prolog approach to solving some problem domains would be interesting to have available, but I'd want it as an module I could interface with from a traditional language such a Python.

If, for instance, I could build a site that could on demand scrape data from elsewhere then run it though an expert system of some type to derive useful information (and maybe kick it back out via something like Google maps, Flex or [your choice of impressive UI]) , and that engine could be constructed quickly using Prolog then I think you're looking at a win. Maybe especially so if you could easily keep an ability for the Prolog processing to remain flexible so the problem it was solving could be fuzzier than is easily handled with normal code.

The trouble is that if you're thinking of some general Prolog type system, as opposed to a targeted adjunctive tool, then I don't think you're going to get anywhere as Prolog itself has failed to gain any significant traction outside specialized areas over the past 20 years.

1

If you are a c++ programmer I'd recommend having a look at the castor library for c++, http://www.mpprogramming.com/cpp/ . This seems to integrate with existing c++ code the best I have seen so far.

0

How will domains and types, especially symbols, be handled?

Prolog clauses are stored as data-units, which is processed through an interpreter, do you mean to write a prolog-type interpreter to handle predicate logic?

Backtracking == recursion is basically what makes prolog 'happen': how can this be minimised?

Many instances of infinite solutions exist: this is bound to cause 'endless looping'.

That said:

It would be nice to mix-and-match C++ and prolog. There are a few times that I wished I could use prolog to solve a data-parsing problem.

I'll monitor this thread to see the outcome...