mattiasw2 / teyjus

Automatically exported from code.google.com/p/teyjus
GNU General Public License v3.0
0 stars 0 forks source link

build in the conditional #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I don't think this is a bug but, if I remember well, a feature of the
teyjus approach to implementing cut.  The following definitions of the
if-then-else are not equivalent.

% Version A
if P Q R :- (P, !, Q ; R).

% Version B
if P Q R :- P, !, Q.
if P Q R :- R.

The usual "Prolog semantics" for if should be given by the second version.
 The query,
  ?- if (1 = X) (print "yes!\n") (print "no!\n").
separates these two: there should only be one solution to this query, not two.

In any case, I think that we might want to add the conditional `if' as
defined in Version B in the "official" lambda Prolog language.  Currently,
I believe that we only commit to certain pervasives in the implementation.
 Things that can be defined, like if, forall, forsome, etc. are not part of
the "official" language.   We should probably have some discussion about
making more predicates "officially" provided by the system.  This could
cause some problems with backwards compatibility if, for example, the token
"if" was used for something else in someone's program.

  -Dale

Original issue reported on code.google.com by dale.a.m...@gmail.com on 28 Mar 2008 at 10:36

GoogleCodeExporter commented 9 years ago
I agree that we should expand the collection of builtins but, as pointed out in 
this
posting, we also need to do this carefully. Thus, the best thing to do at the 
moment
seems to me to be to not change anything but to have a discussion at the 
language
user level about the collection of builtins. 

A neutral solution that provides the best of both worlds is perhaps to provide a
collection of library modules with the Teyjus system that implement control
predicates like if, repeat, spy, etc and even some of the things like forall and
forsome mentioned in the post. There are a couple of issues to be sorted out in 
terms
of the module syntax before libraries become realistic. We are looking into 
this and
will propose a solution in due course.

Original comment by gopalan....@gmail.com on 16 Nov 2008 at 4:51