Technical detail 17 Nov 2009
Today's APL2
News from APL Products and Services at IBM Corporation
Issue Number 14 - Summer 2009
Boost Performance and Productivity
Commercial Rounding Made Faster
The APL2 floor and ceiling primitives round numbers to the nearest integer. Floor rounds down and ceiling rounds up.
Although these kinds of rounding can be very useful, many commercial institutions need a different kind of rounding; they need to round numbers towards zero. They also need to round numbers not just to the nearest integer, but also to the nearest power of ten, such as the nearest hundredth. For example, 3.2768 should be rounded to 3.27 and ¯2.3467 should be rounded to ¯2.35. This kind of rounding is called Commercial rounding.
Commercial rounding is expensive. As much as 30% of some applications' CPU time is spent in commercial rounding. So, it is imperative that programs round as efficiently as possible.
The external function ROUNDC, a high performance implementation of commercial rounding, was added to all APL2 systems in November 2008. ROUNDC is up to an order of magnitude faster than even a very good implementation in APL2.
All About Associated Processor 15
Processor 15 provides Workstation APL2 programmers with several capabilities normally only found in compiled languages. APL2 variables can now be strongly typed and variables' storage can be managed by programs written in other languages. In addition, APL2 expressions can be executed when variables are changed.
APL is traditionally a loosely-typed language. Arrays simply contain numbers and characters and the structure and type of their data can be changed at any time. APL programmers usually view this as one of the language's benefits: they don't have to worry about how data is represented internally; they can focus on their problems. However, many users of other languages view strong typing as a benefit: type checking helps programmers avoid runtime errors.
Variables associated with Processor 15 may be strongly typed. Programmers can specify the type and structure of arrays that are valid for variables. If an invalid array is assigned to an associated variable, Processor 15 issues an error. This can make it much easier to find program errors and boost programmer productivity.
Variables associated with Processor 15 do not reside in the workspace. They do not even have to reside in storage owned by APL2. Variable names can be associated with storage exported by DLLs or with storage allocated by programs written in other languages. The address of storage allocated by Processor 15 can also be passed to other programs. This makes it easy to share data with non-APL programs. In addition, variables associated with Processor 15 can contain arrays that are larger than the workspace.
Programmers may do more than type checking during assignments. Each variable associated with Processor 15 may have a monitor expression which is an arbitrary APL2 statement that is executed each time the variable is changed. Monitor expressions can display messages, call functions, and even signal errors. Monitor expressions can perform any APL2 operation except modify the associated variable's value.
Processor 15 was added to Workstation APL2 in Service Level 12. Support for monitor expressions was added in Service Level 13. For a complete description of Processor 15, see the APL2 User's Guide.
Service Updates
Since the last Today’s APL2, IBM has shipped two updates for the workstation and one mainframe enhancement.
Workstation APL2
Service Levels 13 and 14 were shipped in November 2008 and May 2009. They included the following enhancements:
- Enlist is supported in selective specification expressions.
- Execute Controlled results include errors' execution stack.
- The maximum function line length is raised to 32767.
- The maximum workspace name length is raised to 64.
- The session manager title bar contains the workspace name.
- The Undo command is added to the Edit menu.
- The Edit menu's Execute Line command displays the line's result in a window.
- Custom toolbar buttons can execute APL expressions.
- The APL Assist toolbar shows popup documentation for APL primitives.
- The new Workspace menu's commands open and save workspace files.
- Holding Ctrl and using the mouse wheel or keypad plus and minus keys changes the font size.
Mainframe APL2
The ROUNDC function is available in these PTFs:
TSO - UK41421 and UK44764
CMS - UK41422 and UK4476
APL2 on the Web
A wealth of APL2 information is available:
- Workstation APL2 updates
- Information on mainframe APL2 updates
- Technotes that answer common questions
- Product Documentation
- Trial version of Workstation APL2
Click the Support link for all this and more.
APL2 in High Schools
The IBM Academic Initiative enables educators and researchers at accredited institutions to obtain APL2 at no charge. In addition to colleges and universities, the program now supports high schools. For more information, visit ibm.com/university.
