Expseq
OpenMaple representation of an expression sequence
Description
Method Summary
Examples
Compatibility
The com.maplesoft.openmaple.Expseq class represents a Maple exprseq.
To create an Expseq containing arbitrary data, call newExpseq to create an empty Expseq of the specified length. The elements of the expression sequences are then assigned by calling assign.
The Expseq class implements the java.util.Iterable interface on type Algebraic.
The following methods are defined on Expseq objects.
Note that Expseq publicly inherits from Indexable; therefore, it provides all the member functions from the Indexable and Algebraic classes in addition to those listed here.
void assign( int i, Algebraic val ) throws MapleException
assign sets element i of the expression sequence to val.
Algebraic select( int i ) throws MapleException
select returns the element at index i of the expression sequence.
int length( )
length returns the length of the expression sequence. This is a synonym for numElements.
The Expseq class also includes the following methods which implement the java.util.Iterable interface:
java.util.Iterator<Algebraic> iterator( )
iterator returns an Iterator object which can be used to iterate over the elements of the Expseq.
import com.maplesoft.openmaple.*;
import com.maplesoft.externalcall.MapleException;
class Example
{
public static void main( String notused[] ) throws MapleException
String[] mapleArgs = { "java" };
Engine engine = new Engine( mapleArgs, new EngineCallBacksDefault(), null, null );
Expseq expseq = (Expseq)engine.evaluate( "(1,3,7):" );
System.out.println("Length of expseq: " + expseq.numElements());
for (Algebraic elem : expseq) {
System.out.println("Element: " + elem);
}
Executing this code produces the following output.
Length of expseq: 3
Element: 1
Element: 3
Element: 7
The Expseq command was updated in Maple 2020.
See Also
exprseq
OpenMaple
OpenMaple/Java/Algebraic
OpenMaple/Java/API
OpenMaple/Java/Examples
OpenMaple/Java/List
OpenMaple/Java/Set
OpenMaple/Java/Table
Download Help Document