Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
An open source Prolog interpreter in JavaScript (tau-prolog.org)
11 points by holonomically on Nov 23, 2021 | hide | past | favorite | 2 comments


is there an interesting project suited to Prolog one could use to become familiar with the language?


I did two semesters of heavy Prolog in a college AI course, decades ago.

I followed the early-2000s "Semantic Web" ideas. The actual data was all written as RDF, an application of XML, and it was very verbose and felt clumsy to me.

Prolog would have made some things easier there.

Consider how you might represent ideas about a human family tree.

Start simply, then build it up:

- Every human has a mother and a father, and might have siblings.

- Actually, a biological mother and father are required, but actual care may well be provided by a single mother, or a single father, or any other human, maybe...

- Try again: I am a human. I may or may not produce offspring. Humans are born, require care from other humans in childhood, may perhaps be able to produce children of their own after they have reached a certain age, but need exactly one other human to merge genetic material to produce such children...

... and it just spins up from there.

That sort of set of assertions regarding a conceptual domain is called an "ontology".

Try writing those assertions in Prolog.

Then try to ask questions about the assertions:

- Can a child be older than its mother?

- Try adding an assertion that defines a 'cousin'. Can a person's cousin be older than that person's mother?

Stuff like that.

In computer security, there are notions of 'roles', and 'users', and system objects that might be accessible only to certain users, or users with a particular role, or whatever.

A knowledge base that models a product's supply chain might be interesting. The 'product' is made of 'components'. Some components might be available from more than one 'supplier'. Joe is a supplier who usually ships on time, but his prices are ten percent higher than other supplier for that component... And stuff like that.

I'm sure there are better examples, but there's at least some things to think about. You could write Prolog assertions, or JSON or whatever.




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

Search: