public class EvalAttributes
extends java.lang.Object
ISymbol.FLAT, ISymbol.LISTABLE and
ISymbol.ORDERLESS attributes.ISymbol.FLAT,
ISymbol.LISTABLE,
ISymbol.ORDERLESS| Modifier and Type | Method and Description |
|---|---|
static IAST |
flatten(IAST ast)
Flatten the list (i.e. typically the ASTs head has the attribute
ISymbol.FLAT) example: suppose the head f should be flattened out:
f[a,b,f[x,y,f[u,v]],z] ==> f[a,b,x,y,u,v,z] |
static boolean |
flatten(ISymbol head,
IAST sublist,
IAST result)
Flatten the list (i.e. the ASTs head element has the same head) example:
suppose the head f should be flattened out:
f[a,b,f[x,y,f[u,v]],z] ==> f[a,b,x,y,u,v,z] |
static boolean |
flatten(ISymbol head,
IAST sublist,
IAST result,
int recursionCounter,
int level)
Flatten the list (i.e. the ASTs head element has the same head) element
has the same head) example: suppose the head f should be flattened out:
f[a,b,f[x,y,f[u,v]],z] ==> f[a,b,x,y,u,v,z] |
static boolean |
sort(IAST ast)
Sort the list (i.e. typically the ASTs head has the attribute
ISymbol.ORDERLESS) example: suppose the Symbol f has the attribute
ISymbol.ORDERLESS
f[z,d,a,b] ==> f[a,b,d,z] |
static void |
sort(IAST ast,
java.util.Comparator<IExpr> comparator) |
static IAST |
threadList(IAST ast,
IExpr listHead,
IExpr argHead,
int listLength)
Thread through all (sub-)lists in the arguments of the IAST (i.e.
|
public static IAST flatten(IAST ast)
f[a,b,f[x,y,f[u,v]],z] ==> f[a,b,x,y,u,v,z]ast - the AST whose elements should be flattened.F.NILpublic static boolean flatten(ISymbol head, IAST sublist, IAST result)
f[a,b,f[x,y,f[u,v]],z] ==> f[a,b,x,y,u,v,z]head - the head of the expression, which should be flattened.sublist - the sublist which should be added to the
result list.result - the result list, where all sublist elements with
the same head should be appended.true if a sublist was flattened out into the
result list.public static boolean flatten(ISymbol head, IAST sublist, IAST result, int recursionCounter, int level)
f[a,b,f[x,y,f[u,v]],z] ==> f[a,b,x,y,u,v,z]head - the head of the expression, which should be flattened.sublist - the sublist which should be added to the
result list.result - the result list, where all sublist elements with
the same head should be appended.level - the recursion level up to which the list should be flattenedtrue if a sublist was flattened out into the
result list.public static final boolean sort(IAST ast)
f[z,d,a,b] ==> f[a,b,d,z]ast - the AST will be sorted in place.true if the sort algorithm was used;
false otherwisepublic static IAST threadList(IAST ast, IExpr listHead, IExpr argHead, int listLength)
Sin[{2,x,Pi}] ==> {Sin[2],Sin[x],Sin[Pi]}
@param ast
@param listHead
the lists head (typically F.List)argHead - the arguments head (typically ast.head())listLength - the length of the listargHead threaded into
each ast argument.