Package jason.stdlib

Class findall

All Implemented Interfaces:
InternalAction, Serializable

public class findall extends DefaultInternalAction

Internal action: .findall(Term,Query,List).

Description: builds a List of all instantiations of Term which make Query a logical consequence of the agent's BB.

Parameters:

  • + term (variable or structure): the variable or structure whose instances will "populate" the list.
  • + query (logical formula): the formula used to find values for the term; is has the same syntax as the plan context.
  • +/- result (list): the result list populated with found solutions for the query.

Examples assuming the BB is currently {a(30),a(20),b(1,2),b(3,4),b(5,6),c(100),c(200),c(100)}:

  • .findall(X,a(X),L): L unifies with [30,20].
  • .findall(c(Y,X),b(X,Y),L): L unifies with [c(2,1),c(4,3),c(6,5)].
  • .findall(r(X,V1,V2), (a(X) invalid input: '&' b(V1,V2) invalid input: '&' V1*V2 invalid input: '<' X), L): L unifies with [r(30,1,2),r(30,3,4),r(20,1,2),r(20,3,4)].
  • .findall(X,c(X),L): L unifies with [100,200,100].
  • .findall(X,.member(p(_,X),[p(a,10),p(b,20)]),L): L unifies with [10,20].
  • See Also: