Language and Programming
Maple 2020 includes the following enhancements to the Maple language and programming facilities.
Programming Tools Updates
Improvements to Execution Tracing
The tracelast command can now "see" past caught-and-rethrown exceptions. When an exception is caught and rethrown (by an error statement in a catch clause), the error is reported as having occurred in the procedure containing the catch clause. However, the stack trace produced by tracelast will now include all execution levels down to where the error originally occurred.
If source code for traced procedures is available and kernelopts(keepdebuginfo) is true, then kernelopts(tracelineinfo=N), where N is 0, 1, or 2, controls the display of source file and line number information in the output produced by trace or printlevel:
With kernelopts(tracelineinfo=0), source file and line number information is not displayed.
With kernelopts(tracelineinfo=1), which is the default, source file and line number information is displayed for procedure entry and exit only.
With kernelopts(tracelineinfo=2), source file and line number information is displayed for procedure entry and exit, as well as all other statements for which tracing output would be produced.
The output of the tracelast command will also show source file and line number information when kernelopts(tracelineinfo) is 1 or 2.
New Debugger Commands
A new debugger command, help, displays a concise summary of all the debugger commands and their options. The command can be followed by an optional topic to display only the subset of commands pertaining to the topic (e.g. help stop).
Executing help gdb in the debugger will display a cross reference from GNU debugger to Maple debugger commands.
The new retstep command is similar to the existing return command, except that execution stops at any statement executed after the current procedure returns, instead of the next statement executed in the calling procedure. This can be used, for example, while debugging expressions such as f(g(x)) or seq(f(i),i=1..10), to continue debugging procedure f after having stopped in procedure g.
Additional Information in Error and Warning Messages
Most error and warning messages now display the source file name and line number of the statement in which the error occurred, assuming the source code is available and kernelopts(keepdebuginfo) is true.
Additions to the Java OpenMaple API
The Java OpenMaple Application Program Interface has been extended to simplify access to Maple data structures from Java.
Many OpenMaple classes corresponding to Maple data structures now implement standard interfaces from the java.util package, which enables simpler syntax and easier integration with existing Java code making use of these interfaces. These improved classes include:
The OpenMaple Java List and OpenMaple Java Expseq classes, which now implement the java.util.List interface.
The OpenMaple Java Set class, which now implements the java.util.Set interface.
The OpenMaple Java Table class, which now implements the java.util.Map interface.
In particular, these interfaces enable you to easily iterate over Maple data structures in Java code using Java for-in loops. The following sample code illustrates traversals which implicitly use these interfaces.
When compiled and executed with a Maple instance, the above sample code produces the following result.
StaticCallGraph returns a directed graph which represents a static call graph for the input P. The vertices of the graph are strings which represent procedures or appliable modules, and a directed arc exists from f to g when there is an explicit reference to g in the body of f.
The output is a Maple graph suitable for use with commands from the GraphTheory package.
G≔Graph 1: a directed unweighted graph with 22 vertices and 24 arc(s)
The Slice command in the ListTools package slices a list into a sequence of sub-lists. The number of sub-lists is user-provided, and the lengths of the sub-lists in the sequence differ by at most one. Note that if the specified number of sub-lists is greater than the number of elements in the original list, then the result is a sequence of sub-lists consisting of a single element, followed by empty lists. For example:
For comparison, the LengthSplit command, which splits the list based on a target length, often returns sub-lists with lengths of larger difference:
The Worksheet package contains two new commands: RemoveSection for removing all sections from a Maple document, and TableOfContents for adding section headings to the beginning of a Maple document.
URL[Download] has new options for specifying certificate files, a password for authentication, a proxy and proxy password, timeouts and more.
The Iterator package contains new commands for de Bruijin sequences, Lyndon words, necklaces and prenecklaces, and the Number method for the objects implementing multicombinations and bounded compositions has been extended.
Download Help Document
What kind of issue would you like to report? (Optional)