1:- ensure_loaded('util'). 2
3argt(Arguments,KeyValueTerm) :-
4 not(is_list(KeyValueTerm)),
5 findall(Argument,(member(Argument,Arguments),Argument = KeyValueTerm),Matches),
6 nth1(1,Matches,Match),
7 KeyValueTerm = Match.
8
9argt(Arguments,KeyValueTermList) :-
10 is_list(KeyValueTermList),
11 findall(KeyValueTerm,(member(KeyValueTerm,KeyValueTermList),argt(Arguments,KeyValueTerm)),NewList),
12 KeyValueTermList = NewList.
13
14fixme('implement all these other argXXX methods eventually, but not necessary to finish our important system now').
28argl(Arguments,Key,Value) :-
29 arglHelper(Arguments,Terms),
30 view([terms,Terms]),
31 Term =.. [Key,Value],
32 argt(Terms,[Term]).
33
34arglHelper([Key,Value],[Term]) :-
35 Term =.. [Key,Value].
36arglHelper([Key,Value|RestArguments],[Term|RestResults]) :-
37 Term =.. [Key,Value],
38 arglHelper(RestArguments,RestResults).
77testArgT1(Args) :-
78 argt(Args,verb(Verb)),
79 view([verb,Verb]).
80
81testArgT2(Args) :-
82 argt(Args,[domain(Domain),problem(Problem)]),
83 view([domain,Domain,problem,Problem]).
125testArgs :-
126 testArgT1([verb([test,1])]),
127 testArgT2([domain([test,2]),problem([test,2])]).
130
131
132
133
134
135
136
137
138