compound domains as return values?

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

compound domains as return values?

Unread post by daveplummermd » 8 Apr 2018 21:57

Hello

Is it possible to declare a procure in an interface to a class that returns a compound domain?
Such as:

Code: Select all

interface X getDates()->dates Dates. end interface X
where the return domain is defined:

Code: Select all

domains dates = d (integer,integer,integer).
Thanks in advance,
Dave
Dave Plummer

Harrison Pratt
VIP Member
Posts: 287
Joined: 5 Nov 2000 0:01

Re: compound domains as return values?

Unread post by Harrison Pratt » 8 Apr 2018 23:08

VIP 7 & 8 forbid naming domains and facts with the same name, unlike VIP 5x. This seems like an annoyance when you are upgrading your code and thinking from 5x, but it will save you debugging time in the future.

This sort of approach works:

Code: Select all

class dateStore : dateStore     open core end class dateStore

Code: Select all

implement dateStore     open core facts     date_fact : ( integer, integer, integer ). clauses     tryGetDate() = date(M,D,Y) :-         date_fact(M,D,Y),         !. end implement dateStore

Code: Select all

interface dateStore     open core domains    dateDOM = date( integer, integer, integer ). predicates     tryGetDate : () -> dateDOM determ. end interface dateStore
Also, shouldn't dates = d (integer,integer,integer). in your example be date = d (integer,integer,integer) ?

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

Re: compound domains as return values?

Unread post by daveplummermd » 15 Apr 2018 22:16

Thanks so much.
Dave Plummer

Post Reply