+ 4

Can I define new rules while execution using predicates?

For example:- In a file- am(i,best). am(A,B):-set(am(A,B)).%here is an imaginary function set that defines a new rule that am(A,B). :-op(451,xfx,am). In swi- ?- consult(file). true. ?-i am great.% this should define a rule that, |'am(i, great)'. I=great. true. Also, I want the program to define a new rule only when I use the operator 'am' not the predicate 'am'.

17th Aug 2017, 4:33 PM
Prabhakar Dev
Prabhakar Dev - avatar
2 ответов
+ 2
@Prabhakar maybe by Google searching you can find something because I think in SL arent users which use prolog. Some years ago at the University I had a course with Winprolog If Im not wrong about it and I remember its very complex. I remember a problem to draw fractals and we did a dll library for Windows which we use in a program coded at Borland C++ Builder
1st Sep 2017, 12:58 AM
Daniel
Daniel - avatar
+ 2
I dont know if it is something which you can use for your problem but I share with you https://www.doc.gold.ac.uk/~mas02gw/prolog_tutorial/prologpages/rules.html
1st Sep 2017, 1:00 AM
Daniel
Daniel - avatar