Hacker News new | past | comments | ask | show | jobs | submit login

> The point of Prolog as a practical logic programming language really is that it is portable accross Prolog implementations based on ISO Prolog (and maybe prolog-commons API compatibility). If you're using a Prologish tool (a Java framework, say) that is not quite Prolog, then you're loosing the compatibility for very little gain IMHO.

I feel like I might be missing something obvious, but I'm not getting what the "compatibility" you refer to would give me in my specific situations? It looks like you're saying "if you write a Prolog program, it's compatible across Prolog platforms." Well, sure, but how is that fundamentally more portable situation than (for example) "if I have a logic programming framework in ES16, it works in all browsers that run modern JavaScript"?

If I'm specifically trying to do something in the browser (again, for example) and have a problem within that context where logic programming might be useful, having a way to use logic programming in JS makes more sense, doesn't it?




I'm not disagreeing that if you're developing a Web app, embedding logical or constraint programming techniques into a JavaScript API could make sense. OTOH, there's an obvious way for data exchange between JavaScript and Prolog, in that JSON can be be parsed by using Prolog's embedded `op/2` predicate and operator-precedence parser for defining custom DSLs.


What would be the workflow in Prolog if I want to import a set of facts from an external source, like a database/JSON/CSV?


JSON could be parsed as a term by Prolog, with suitable priority/associativity definitions for the comma, colon, and curly brace operators.

For CSV, you could write a DCG grammar for the particular file format at hand.

Integration with a relational DB, itself being based on logic, would be very different. Most Prologs have APIs to map tables to predicates.


If you replace Prolog with SQL - does it make more sense?


Yes, and I missed it because I was thinking in terms of "hmm, I wonder if there are any points in my client-side code-base that could be cleaned up by using logic programming?"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: