Joe Riel

7742 Reputation

22 Badges

14 years, 185 days

MaplePrimes Activity

These are Posts that have been published by Joe Riel

The Maple overload command provides a useful mechanism for splitting the implementation of a procedure that operates on different types of arguments into separate procedures. This article describes the mechanism that it uses to select the procedures, illustrates subtle issues, and shows how they can be resolved.
The latest edition of TUGboat (vol. 28 no. 2, 2007), the journal of the TeX users group, contains an article by Edward Reingold, Writing numbers in words in TeX, which, as its title states, gives TeX macros for converting integers to names. In this case, American English names. For my amusement Sunday I wrote the equivalent procedure in Maple.
Here is the article. I wrote this as a blog entry, and felt it was better to leave it one place rather than duplicating it. Besides, I don't know how to delete a blog entry. A cheap way to earn five points; however, my next page addition—in the works—to this book will be recompense.
Occasionally it is necessary to temporarily assign a global flag to perform an action. Consider, for illustration, a procedure that returns the inert form of a procedure. We want it to be able to work with procedures that are local to modules. To do that, we need to temporarily assign the kernel flag opaquemodules to false.
GetInert1 := proc(p::uneval)
local opacity,inert;
    opacity := kernelopts('opaquemodules'=false);
    inert := ToInert(eval(p));
end proc:
Here is a small module to test this on:
First 7 8 9 10 11 12 13 Page 9 of 16