Discussions related to Visual Prolog
billgates198606

use function as a variable

Unread post by billgates198606 »

predicates
usefunc(string word,function func{T1,T2})
clauses
run():-
readln(word )
readln(A,B)
usefunc(word,func{T1,T2})
word = update %means if word is update it will call update function
func(A,B) % IF word is delete mean it will call delete function

how do define usefunc(word,func{T1,T2}) 's predicates and its domains
_________________
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Have you tried typing the code above into a Visual Prolog file. I think there is at least 20 syntax errors.

Do you know that variables must start with an uppercase letter?

I do not at all understand what you mean by function func{T1, T2}:
  • What is function?
  • What is func?
  • What is T1?
  • What is T2?
By b]readline(word)[/b] I guess that you want to read a line from somewhere and put the result in a variable. But a variable cannot start with a lowercase letter, so word will not work, it must be Word (and when you write it correctly in the editor it will become green: variables are green).

...
Regards Thomas Linder Puls
PDC
billgates198606

Unread post by billgates198606 »

domains
define the domain of func()

predicates
usefunc(string word, domainoffunc func(T1,T2))
clauses
run():-
readln(Word ) ,
readln(A,B) ,
usefunc(word,func(T1,T2))
word = update %means if word is update it will call update function update()
func(A,B) % IF word is delete mean it will call delete function delete()

how do define func(word,func(T1,T2)) how define it's predicates and its domains
_________________
Paul Cerkez
VIP Member
Posts: 106
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez »

I get the impression that you are trying to implement something in VIP but are not using the VIP language.

is your Prolog (assuming it is prolog) from another style?

If yes, you need to translate it into the VIP implementation.

To echo what Thomas said, you need to go through the tutorials on the fundimentals. A lot of people on this site will help you along toward understanding but you need to do the the basics first.
AI Rules!
P.
Post Reply