MapleUnique - return unique copy of an object in external code
|
Calling Sequence
|
|
MapleUnique(kv, s)
|
|
Parameters
|
|
kv
|
-
|
kernel handle returned by StartMaple
|
s
|
-
|
Maple object
|
|
|
|
|
Description
|
|
•
|
This function is part of the OpenMaple interface to Microsoft Visual Basic.
|
•
|
The MapleUnique function processes the Maple expression, s, and returns the unique normalized copy of that expression. For example, if you create the number num = one-billion, and then compute the number val = 2*500-million, an address comparison of num and val does not indicate equality. For example, after calling num = MapleUnique(kv,num);, both num and val point to the same memory.
|
|
|
Examples
|
|
Sub TestConvertToMaple(ByVal kv As Long)
|
Dim list, args As Long
|
list = MapleListAlloc(kv, 15)
|
'MapleGcProtect kv, list
|
MapleListAssign kv, list, 1, ToMapleBoolean(kv, 1)
|
MapleListAssign kv, list, 2, ToMapleBoolean(kv, 0)
|
MapleListAssign kv, list, 3, ToMapleBoolean(kv, -1)
|
MapleListAssign kv, list, 4, ToMapleBoolean(kv, 2)
|
MapleListAssign kv, list, 5, ToMapleChar(kv, "M")
|
MapleListAssign kv, list, 6, ToMapleComplex(kv, 1.1, 2.2)
|
MapleListAssign kv, list, 7, ToMapleComplexFloat(kv, _
|
ToMapleFloat(kv, 3.3), ToMapleFloat(kv, 4.4))
|
MapleListAssign kv, list, 8, ToMapleInteger(kv, 98765)
|
MapleListAssign kv, list, 9, ToMapleFloat(kv, 3.1415)
|
args = NewMapleExpressionSequence(kv, 2)
|
MapleExpseqAssign kv, args, 1, ToMapleName(kv, "x", True)
|
MapleExpseqAssign kv, args, 2, ToMapleName(kv, "x", True)
|
MapleListAssign kv, list, 10, ToMapleFunction(kv, _
|
ToMapleName(kv, "int", True), args)
|
MapleListAssign kv, list, 11, ToMapleNULLPointer(kv)
|
MapleListAssign kv, list, 12, ToMapleRelation(kv, ">", _
|
ToMapleName(kv, "X", True), ToMapleInteger(kv, 1))
|
MapleListAssign kv, list, 13, ToMapleString(kv, "A string")
|
MapleListAssign kv, list, 14, ToMapleUneval(kv, _
|
ToMapleName(kv, "Z", True))
|
MapleListAssign kv, list, 15, ToMapleNULL(kv)
|
'note this will get removed when the list is flattened
|
MapleALGEB_Printf1 kv, "%a", MapleUnique(kv, list)
|
End Sub
|
|
|
|
|