The Mathematica Journal
Download This Issue
Feature Articles
Graphics Gallery
Tricks of the Trade
In and Out
The Mathematica Programmer
New Products
New Publications
News Bulletins
Editor's Pick
Write Us
About the Journal
Staff and Contributors
Back Issues

MathLink Issues

MathLink is a protocol for sending and receiving Mathematica expressions. Its uses fall into two general categories. The first and more common application is to allow external functions, written in other languages, to be called from within the Mathematica environment. (For a nontrivial example of such an application as well as for a brief discussion of the MathLink basics see [2].) Exercise Maker is an application falling into the other category. It uses the Mathematica kernel as a computational engine to evaluate the generating and verifying programs whenever needed. While the verifying program evaluates to a simple string that is the error message seen by students, the generating program evaluates to a rather complex list that is a full definition of the objects comprising the exercise. We interpret this list by issuing many separate MathLink requests that result in very simple expressions--strings or numbers. This is possible because the list is always assigned to the symbol exerciseList. We issue those many requests from different C++ routines, which is essential for greater flexibility and extensibility of EM with new types of objects in the future. The interpretation goes as follows.

· Find out how many objects are in the problem statement/answer template.
· Determine the type of the ith of these objects. Create an object of that type.
· Send an initialize message to the newly created object. In response, the object itself starts issuing further MathLink requests in order to obtain relevant attributes and values (see the definition of an object) for the particular type it belongs to.
· The previous two steps are repeated for each of the objects in the problem statement and the answer template.

Converted by Mathematica      October 5, 1999

[Prev Page][Next Page]