public class sublist extends DefaultInternalAction
Internal action: .sublist(S,L)
.
Description: checks if some list S is a sublist of list L. If S has free variables, this internal action backtracks all possible values for S. This is based on .prefix and .suffix (try prefixes first then prefixes of each suffix).
Parameters:
Examples:
.sublist([a],[a,b,c])
: true..sublist([b],[a,b,c])
: true..sublist([c],[a,b,c])
: true..sublist([a,b],[a,b,c])
: true..sublist([b,c],[a,b,c])
: true..sublist([d],[a,b,c])
: false..sublist([a,c],[a,b,c])
: false..sublist(X,[a,b,c])
: unifies X with any sublist of the list, i.e., [a,b,c], [a,b], [a], [b,c], [b], [c], and [] in this order;
note that this is not the order in which its usual implementation would return in logic programming (see note on .prefix).concat
,
length
,
sort
,
nth
,
max
,
min
,
reverse
,
prefix
,
suffix
,
difference
,
intersection
,
union
,
Serialized FormConstructor and Description |
---|
sublist() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkArguments(Term[] args) |
static InternalAction |
create() |
java.lang.Object |
execute(TransitionSystem ts,
Unifier un,
Term[] args)
Executes the internal action.
|
int |
getMaxArgs() |
int |
getMinArgs() |
canBeUsedInContext, destroy, prepareArguments, suspendIntention
public static InternalAction create()
public int getMinArgs()
getMinArgs
in class DefaultInternalAction
public int getMaxArgs()
getMaxArgs
in class DefaultInternalAction
protected void checkArguments(Term[] args) throws JasonException
checkArguments
in class DefaultInternalAction
JasonException
public java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args) throws java.lang.Exception
InternalAction
execute
in interface InternalAction
execute
in class DefaultInternalAction
java.lang.Exception