Help with type differences

Discussions related to Visual Prolog
daveplummermd
VIP Member
Posts: 87
Joined: 18 Jul 2006 17:18

Help with type differences

Unread post by daveplummermd » 8 Mar 2018 21:53

I am having trouble resolving this error:
The expression has type '() -> ::string* procedure', which is incompatible with the type '::string*'

that points to this code:

Code: Select all

 onPushButton2Click(_Source) = button::defaultAction :-         xx(DB),         List = DB:getallaslist,         listboxnew_ctl:addList(List),         !.
where getallaslist predicate is definesd in interface:

Code: Select all

predicates     addstring : (string) -> integer.     saveitall : ().     consultitall : ().     getallaslist : () -> string*.
with this clause in the *.pro file

Code: Select all

    getallaslist() = List :-         List = [ X || placed(X, _, _) ],         !.        

It objects to equating "string* procedure" to and string*.
I have tried variious "convert" and "convertToStringList" w/o success.
Can you advise

Thanks in advance.
Dave Plummer
Dave Plummer

User avatar
Thomas Linder Puls
VIP Member
Posts: 2407
Joined: 28 Feb 2000 0:01

Re: Help with type differences

Unread post by Thomas Linder Puls » 9 Mar 2018 9:54

When you write:

Code: Select all

List = DB:getallaslist,
List will be a predicate that can return a list. You will have to invoke the predicate (to an empty set of arguments '()') to obtain the list:

Code: Select all

List = DB:getallaslist(),
Regards Thomas Linder Puls
PDC

daveplummermd
VIP Member
Posts: 87
Joined: 18 Jul 2006 17:18

Re: Help with type differences

Unread post by daveplummermd » 9 Mar 2018 14:49

Of coarse!
thanks you sir.

dp
Dave Plummer

Post Reply