public class prefix extends DefaultInternalAction
Internal action: .prefix(P,L)
.
Description: checks if some list P is a prefix of list L. If P has free variables, this internal action backtracks all possible values for P.
Parameters:
Examples:
.prefix([a],[a,b,c])
: true..prefix([b,c],[a,b,c])
: false..prefix(X,[a,b,c])
: unifies X with any prefix of the list, i.e., [a,b,c], [a,b], [a], and [] in this order;
note that this is different from what its usual implementation in logic programming would result,
where the various prefixes are returned in increasing lengths instead.concat
,
length
,
sort
,
nth
,
max
,
min
,
reverse
,
suffix
,
sublist
,
difference
,
intersection
,
union
,
Serialized FormConstructor and Description |
---|
prefix() |
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