assign - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Table.assign

add an entry into the Maple Table

 Calling Sequence void assign( Algebraic key, Algebraic val ) throws MapleException

Parameters

 key - index to associate with the value val - value to assign into the table

Description

 • The assign function associates the Algebraic object val with the Algebraic index key in the Table.
 • If a value is already assigned to the index key, it is overwritten by val.

Examples

 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 ); Table t = engine.newTable(); System.out.println( t ); t.assign( engine.newNumeric( 1 ), engine.newNumeric( 100 ) ); t.assign( engine.newNumeric( 2 ), engine.newNumeric( 200 ) ); t.assign( engine.newNumeric( 3 ), engine.newNumeric( 300 ) ); t.assign( engine.newNumeric( 4 ), engine.newNumeric( 400 ) ); System.out.println( t ); t.assign( engine.newNumeric( 3 ), engine.newNumeric( 600 ) ); t.assign( engine.newNumeric( 4 ), engine.newNumeric( 700 ) ); System.out.println( t ); } }

Executing this code produces the following output.

 table([]) table([(1)=100,(2)=200,(3)=300,(4)=400]) table([(1)=100,(2)=200,(3)=600,(4)=700])