Introduction to APL

From NARS2000
Revision as of 17:22, 22 February 2013 by Paul Robinson (talk | contribs)
Jump to navigationJump to search

Welcome to the wonderful world of APL. Whether you've never done programming before or you're a journeyman programmer, APL is going to be something new to you. APL works like no other programming language. First, APL operates from right to left. All other programming languages operate from left to right. When it comes to computing mathematical formulas, APL has no precedence; unless you put something in parenthesis, all mathematical computations are done strictly right to left to produce the result.

Also, APL uses a specialized keyboard. Many of the actions you have to write a program in other languages can be done in one character in APL. While your typical programming language would show 3 times 4 as 3*4, APL has a multiply symbol, so it is written as 3×4, and to create one half or 1/2 in most languages, in APL you would enter 1÷2 .


So, for example, if you have the following mathematical expression

4 × 5 - 10

Your typical programming language would compute it as 4×5 which is (20), then 20 - 10, resulting in 10. APL will compute it as 5-10 (-5) * 4, or -20. You can adjust this by placing arguments within parenthesis. If your expression was written as

(4 × 5) - 10

It would produce the same answer no matter what programming language you use.