4 ms·
I disagree! 'bob' is a fine identifier for an object in the domain of discourse and an excellent key to bind together disparate facts representing diverse infor
by YeGoblynQueenne 5y ago
I disagree! 'bob' is a fine identifier for an object in the domain of discourse and an excellent key to bind together disparate facts representing diverse information about the object. For example:
person_name(bob, "Bob").
person_town(bob, "Bobberton").
person_occupation(bob, "Bobbie").
person_hobby(bob, "Bobbing").
And so on. And if there's multiple Bobs, 'bob1', 'bob2', 'bob3' etc, are also fine identifiers.
You certainly don't want to have "King Solomon's Mine" as the first term in a fact. That's fine for user-level representation, but not so much as a system-level representation. 'place_name("King Solomon's Mine") would look downright awful during debugging, especially if it were expanded into a character list.
(I use text debugging exclusively, so YMMV).
Anyway that's how I write all my Prolog programs so it certainly arises in practice.
- triska 5y agoYour example code now already uses lists of characters for names, and it is very readable. A good debugger will emit the exact same representation you are now using in the code, such as "Bobberton", "Bobbing" etc., and it will be very readable as well.