http://www.perlmonks.org?node_id=187652


in reply to AI::Perlog -- Q&A
in thread AI::Perlog -- Simple implementation

Just one thing I'd like to say now, What about Who? :) Or, how to differentiate between declarations and queries.. Maybe you want to say that the user specified in the string $Who does in fact own gold.

So to answer your question about $Who syntax I started thinking about dbi-like placeholders, (e.g. :who) but Who can be multivalued, right? So a Set object or even a simple list might be good.

Somehow I got this funny idea of letting the underscore ("anyone"/"anything") symbol contribute dimensions to the answer of who gives what to Kudra, so $pg->gives(qw( _ _ kudra )) could give you a two-dimensional array, which works out to a hash %_ that says $_{who} = what. Is this useful? One problem I see besides speed is that of autovivification. If your structure didn't present autoviv. problems to the casual user you could even return an array of references to points in the knowledge base so they could easily modify it. I think I need to know a lot more about how Prolog is used to be intelligent about this.

I went back to the Haskell page when thinking about your question re embedded facts. I was interested to see that they mention SQL in the context of functional languages. And from their languages page I found an example of syntax in the Curry language which might be applicable.