APL+WebComponent APL Language
The function of APL+WebComponent is to publish the UI to an application, not to replicate all of the functionality of the application in the browser. The APL data manipulation should remain in the APL workspace on the server, with the UI being published to the browser. Typical APL functions which would be published are those that deal with data manipulation as relates to the UI, such as deleting blanks, removing and adding rows to 2 dimensional matrices, etc. For display purposes the browser reserves the character code APL uses for match, so we have inserted [match] in those cases.
Primitive Functions
Arithmetic Functions
Supported:
ƒ Base value
? Deal, Roll
÷ Divide, Reciprocal
µ Logarithm, Natural logarithm
— Maximum, Ceiling
˜ Minimum, Floor
- Minus, Negate
+ Plus, Conjugate
* Power, Exponential
‚ Representation
| Residue, Magnitude
× Times, Signum
± Trigonometric functions, Pi times
Not supported:
! Binomial, Factorial
Ž Matrix divide, Matrix inverse
Boolean Functions
Supported:
^ And
= Equal
> Greater than
‰ Greater than or equal
< Less than
ˆ Less than or equal
[match] Match
Š Nand
~ Not
¬ Not equal
‹ Nor
Ÿ Or
General Functions
Supported:
Functions that return a property
[match] Depth
½ Shape
Functions that return an index
” Grade down
“ Grade up
¼ Index of, Index generator
Miscellaneous functions
– Execute
• Format, not Pattern format
Operators
Supported:
¨ Each, works at one level, not for multiple nested elements
°.f Outer product limited to one level of nesting, and cannot produce higher ranking results than 2
š Reduction, Compress, Replicate (first dimension)
/ Reduction, Compress, Replicate (last dimension)
š or / N-wise Reduction
™ Scan, Expand (first dimension)
\ Scan, Expand (last dimension)
Not Supported:
f.g Inner product (^.= is supported)
Structural Functions
Supported:
, or ® Catenate, Laminate
‡ Drop
› Enclose
¹ Member of, Enlist
º Find
› Partition
œ Pick, Disclose
, Ravel
½ Reshape
´ Reverse, Rotate (first dimension)
² Reverse, Rotate (last dimension)
† Take, First
³ Transpose
~ Without
Not Supported:
Þ Indexing
Syntax and Miscellaneous Symbols
Supported:
Symbols associated with values
„ Assignment
¯ High minus
[] Index into
Œ Evaluated input, Output to screen
Places output in an alert box
Prompt, Obtain text input
Does not wait for input, but places
output in main browser window
Ð Zilde
Symbols associated with functions
… Branch, not supported within control structures or branching to a line number or Œlc
© Comment n/a
: Label separator, Keyword indicator
©’ Public comment n/a
ª Statement separator
Syntax symbols
; Axis separator, for 2 dimensions
' " Character string delimiters
’ Del n/a
‘ Delta
Delta underscore
# Number sign
_ Underscore
System Functions and Variables
Array Manipulation
Supported:
ŒDR Data type and conversion
ŒENLIST Array to vector
ŒFI Numeric format
ŒFIRST First of an array
ŒMIX Reduce nesting
ŒSPLIT Increase nesting
ŒSS String search
ŒVI Verify numeric
Not Supported:
ŒFMT Format
ŒPENCLOSE Array to nested vector
ŒEXPAND Array fill
ŒREPL Replicate array
ŒTYPE Numeric / character
Component File Management
Not applicable, use RunAtServer to execute code on server
Error Handling and Debugging
Information required for error handling and debugging can be included in project or removed at time of creation.
Supported:
ŒDM Diagnostic message
ŒELX Error latent expression
ŒLC Lines on stack (only in debug mode)
ŒSI State indicator
ŒERROR Throw error
Not Supported:
ŒALX Attention latent expression
ŒMF Time function n/a
ŒSA Stop action n/a
ŒSINL Character state indicator n/a
ŒSTOP Set / cancel stop n/a
ŒTRACE Set / cancel trace n/a
ŒWATCHPOINTS Set / cancel watch points n/a
Extended File Functions
Not applicable, use RunAtServer to execute code on server
Function and Variable Manipulation
Supported:
ŒCRL Function line representation, requires function in server workspace
ŒCRLPC Function public comment, requires function in server workspace
ŒEX Erase functions or variables
ŒIDLIST List objects in WS
ŒIDLOC List object types in WS
ŒNC List object types, works only with fn left argument
Not Supported:
ŒCR Character matrix function representation n/a
ŒLOCK Lock functions n/a
ŒNL List object names n/a
ŒVR Vector representation of function n/a
ŒUCMD Execute user command
ŒSIZE Get size of object
ŒFX Define function from ŒCR representation
ŒDEFL Replace / insert function line
ŒDEF Define function(*)
ŒERASE Erase functions or variables
Input Related and Miscellaneous
Not applicable
ŒDL Delay execution (RunAtServer)
Interface to Operating Systems and Non-APL Programs
Not applicable, use RunAtServer to execute code on server
Native File Management
Not applicable, use RunAtServer to execute code on server
Session Information
Supported:
ŒAI Accounting information
ŒCT Comparison tolerance (RunAtServer)
ŒIO Index origin
ŒLIB File directory (RunAtServer)
ŒLIBD Set library to directory (RunAtServer)
ŒLIBS List libraries and directories (RunAtServer)
ŒSYS System internals, limited to elements appropriate to APL+WebComponent
ŒTS Timestamp
ŒWSID WS name
ŒWSTS WS timestamp, timestamp of APL+WebComponent workspace
Not Supported:
ŒPP Print precision
ŒPW Print width
ŒRL Random number seed, no action, as random seed created by Jscript for each session
ŒSYMB Symbol table
ŒSTPTR Symbol table pointer
ŒWA Workspace available n/a
ŒWSOWNER WS owner
ŒWSSIZE WS size
Workspace Management
Supported:
ŒLX Latent (on load) expression
Not Supported:
ŒCOPY Copy APL objects from WS
ŒLOAD Load APL WS
ŒPCOPY Copy APL objects from WS (protected)
ŒPSAVE Save active WS (protected)
ŒQLOAD Load WS without message
ŒSAVE Save active WS
ŒWSLIB WS directory
ŒXLOAD Load WS without ŒLX
System Constants
Supported:
ŒAV Atomic vector (character set)
ŒSYSID APL system ID (APL+WebComponent)
ŒSYSVER APL system version
ŒTC and ŒTCxx Terminal control characters
ŒUL Reports number of users logged in
ŒUSERID Workstation ID
Control Structures
Supported:
:IF :ELSE
:FOR :IN
:WHILE :UNTIL
:REPEAT :UNTIL
:SELECT :CASE
:RETURN
Not Supported:
GOTO
Branching in a control structure is not supported
Extended File Functions
Not applicable, use RunAtServer to execute code on server
Data Types
Supported:
Data types
11 1-bit boolean
82 8-bit character
323 32-bit integer
645 64-bit floating-point data (IEEE format)
326 32-bit pointer
807 80-bit heterogeneous
Data Structures:
Supported:
Scalars
Vectors
Vectors of Vectors
Matrices (2 dimension only)
Vectors with Matrix elements
Matrix with Matrix elements
All APL data structures
Not Supported:
Matrices with dimensions greater than 2
Deeply nested structures may cause unintended results with some operators
Using APL+WebComponent and APL+Win
Scoping of variables:
Variables which are localized, exist only in the function in which they are localized. For instance if a function foo localized a variable arg, such as:
foo;arg
arg„1
foo1
When function foo1 is called, foo1 will see arg either as undefined or be the value for global arg.
Œsysid
This returns APL+Js in the APL+WebComponent version. Using this you can test to discover which version of APL is running. For instance:
Œsysid [match] 'APL+Js'
Returns a 1 if the APL+WebComponent version is running. This is very useful when defining code which may be specific for the APL+WebComponent system.
AplJsversion
This reserved word is used to permit the inclusion of Jscript code in your application. There are times when it is very useful to be able to use Jscript directly, this is similar to including assembler code or WCALLs to speed up a particular task. For instance Jscript has very powerful tools for string manipulation, and including this code in a function which deletes trailing blanks is very useful. For example:
:if AplJsversion
// Jscript here
:else
© APL code here
:endif
Where the AplJsversion function is:
’ r„AplJsversion
[1]
[2] r„Œsysid [match] 'APL+Js'
’
This causes the APL code to always execute in the APL+Win application. However, the APL+WebComponent SDK uses this tag to include only the Jscript code in the APL+WebComponent application.
This is particularly useful when using an ActiveControl such as the Excel ActiveControl. You can simply copy and paste sample Jscript code from the Microsoft MSDN or other sample sources, and the Excel will work immediately. Then you can take your time to make the same code work in the APL+Win application. In general, all of the properties, methods and events of an ActiveControl are directly available as documented in the control.
DHTML style properties
DHTML provides a wealth of properties which are not available in APL+Win. To make these available the user property is used. For instance:
Œwi '‘style_backgroundColor' 'buttonface'
Œwi '‘style_fontFamily' 'MS Sans Serif'
Œwi '‘style_fontSize' 12
Sets the style properties of the control as shown. This gives the developer access to all of style properties to enhance the appearance of their application in the APL+WebComponent system without impacting the APL+Win system. It is important to understand that these style properties are not the same or related in any way to the APL style properties. These style properties are the DHTML style properties. This is the reason that the delta is used to set them. The underscore _ indicates the period separator in the DHTML style property. This same convention can be used to set any property on an object, even when there is a conflict with an APL property. This is similar to using the x to set properties on ActiveControls in the APL+Win system.
Reserved words in APL+WebComponent
Because APL+WebComponent is built on Jscript, the reserved words in Jscript apply to APL+WebComponent.
JScript has a number of reserved words that you cannot use as identifiers. Reserved words have a specific meaning to the JScript language, as they are part of the language syntax. Using a reserved word causes a compilation error when loading your script.
JScript also has a list of future reserved words. These words are not currently part of the JScript language, although they are reserved for future use.
Reserved Words (case sensitive, capital versions are not reserved)
break |
delete |
function |
return |
typeof |
case |
do |
if |
switch |
var |
catch |
else |
in |
this |
void |
continue |
false |
instanceof |
throw |
while |
debugger |
finally |
new |
true |
with |
default |
for |
null |
try |
|
Future Reserved Words
abstract |
double |
goto |
native |
static |
boolean |
enum |
implements |
package |
super |
byte |
export |
import |
private |
synchronized |
char |
extends |
int |
protected |
throws |
class |
final |
interface |
public |
transient |
const |
float |
long |
short |
volatile
|
When choosing identifiers it is also important to avoid any words that are already the names of intrinsic JScript objects or functions, such as String or parseInt.
While Jscript objects can be used, there can be complications, so they should be used judiciously, (case sensitive).
ActiveXObject |
Number |
Global |
Arguments |
Object |
RegExp |
Array |
String |
VBArray |
Boolean |
parseInt |
parseFloat |
Date |
Enumerator |
status |
Math |
Error |
|