public class sort extends DefaultInternalAction
Internal action: .sort
.
Description: sorts a list of terms. The "natural" order for each type of
terms is used. Between different types of terms, the following order is
used:
numbers < strings < lists < literals (by negation, arity, functor, terms, annotations) < variables
Parameters:
Examples:
.sort([c,a,b],X)
: X
unifies with
[a,b,c]
.
.sort([C,b(4),A,4,b(1,1),"x",[],[c],[a],[b,c],[a,b],~a(3),a(e,f),b,a(3),b(3),a(10)[30],a(10)[5],a,a(d,e)],X)
:
X
unifies with
[4,"x",[],[a],[c],[a,b],[b,c],a,b,a(3),a(10)[5],a(10)[30],b(3),b(4),a(d,e),a(e,f),b(1,1),~a(3),A,C]
.
.sort([3,2,5],[2,3,5])
: true.
.sort([3,2,5],[a,b,c])
: false.
concat
,
delete
,
length
,
member
,
nth
,
max
,
min
,
reverse
,
difference
,
intersection
,
union
,
Serialized FormConstructor and Description |
---|
sort() |
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