Re: Dali : A standard data structure library for Prolog



Bad netiquette: you ask a question on a newsgroup, expect public answers,
not private ones.

I guess it's obvious I don't write alot in newsgroups :-). I just
didn't want to bother anyone but I guess that's the risk of being in a
newsgroup.


1) isn't it an overkill to have every exported predicate start with
boolean in you boolean.pl ? Isn't the module system good enough to
make typing the redundant prefix boolean_ totally redundant ?

Unfortunately, the prefix is necessary. If a person wanted to load two
of my graph-modules without the prefixes, the second module wouldn't
be loaded because of name clashes. I don't see how I can resolve those
name clashes in the module system I use. Logtalk solves the name
clashes but we need to type the modulename as prefix again.

2) boolean_boolean/1 has as comment:
Checks if a given atom is a boolean or not
but also part of the comment is
"boolean_boolean(-Boolean:boolean) is semidet."

What does "checking" mean with mode - ?
Or perhaps I should ask: what is your notion of mode - or semidet ?
Because my notions would make the comment into
"boolean_boolean(-Boolean:boolean) is multidet"

That's indeed a mistake. It should be multi or multidet and the
comments I use are a little bit strange. I'm just not used to write
comments in a logic programming language. I'm working on it right now.
By the way, is there a tool to test or generate determinism of a
predicate? That would make it easier to remove mistakes like the
above.


Let's now look at the first clause of your definition of boolean_and/3:

boolean_and(false, _, false).

Why is it not

boolean_and(false,X,false) :- boolean_boolean(X).
?
I am asking because your second clause of boolean_and/3 suggests that you
want to deal with ill-typed input, but the first one doesn't. Why ?

And about the second clause:
boolean_and(true, Boolean, Boolean):-
boolean_boolean(Boolean).
why did you choose to fail on non-boolean input (second arg) to this pred,
instead of throwing an error: throw [or raise_exception, I can't
remember which] is ISO after all !

The code of boolean_and/3 should be :
boolean_and(true,Boolean,Boolean).

I don't offer the detection of input-errors. It would slow down every
predicate. In worst case it would slow down a predicate by a constant.
Efficiency is my goal therefore I try to keep my predicates as "light"
as possible.
I do offer the option of testing input (boolean_boolean/1) but the
programmer has to add the code himself.

Maybe more remarks/questions after I see reasonable answers to the above :-)
I truly appreciate the remarks and question.


My project is now also available at : http://sourceforge.net/projects/dali-prolog/


Cheers,
Koen Plasmans.

P.S.: Sorry, for replying so late. I was busy writing my thesis :-).

.



Relevant Pages

  • Re: A minimal module system for Prolog
    ... Here I advance a proposal for a minimal module system for the Prolog programming language. ... Among these, the most prominent are the severe limitation on name spaces which is imposed by the import/export features, and the "pure" implicit module qualification which generates some inconsistencies within the language. ... Another predicate, namely strip_module/3, can be defined in terms of the others. ... This does not mean that implicit qualification cannot be used, but the following rule applies: if a predicate is not module-qualified it is searched first in the context module, and if not found, it is searched in the system module. ...
    (comp.lang.prolog)
  • Re: A minimal module system for Prolog
    ... should be justified by being in the context module of that predicate, ... fact that no conflict exists at the call time. ... I would like to know if the possibility exists to run a Prolog system ... develop his own module system on top of a *clean* Prolog. ...
    (comp.lang.prolog)
  • Re: "A random real number will be on a computables list to an infinite number of digits"
    ... you have a vocabulary of 20 books George, ... > it to an infinite number ... > is that some prefix of the real is also a prefix of some element of ... So you could define a predicate ...
    (sci.math)
  • Re: "A random real number will be on a computables list to an infinite number of digits"
    ... you have a vocabulary of 20 books George, ... > it to an infinite number ... > is that some prefix of the real is also a prefix of some element of ... So you could define a predicate ...
    (sci.logic)
  • Re: Append/3 and recursion problem
    ... You process the head, and then you process the rest of the list. ... Your first clause specifies what happens when you reach the end of your input list. ... Your second clause is meant to specify what happens when Fa>= F. What do you think happens when Fa < F? ... Here is a simple predicate to use as a model. ...
    (comp.lang.prolog)