openAPL employs 1-origin indexing apl executes apl script and sets fonts and keymappings necessary for openapl under KDE 3.5.10 the compose key is set to right windows key this invokes: setxkbmap -option keypad:oss,compose:rwin which is necessary to get the keyboard to work for openapl issuing a xmodmap command like 'xmodmap usapl.txt' will mess up the keymap necessary for openapl to work. One must exercise care when working with other versions of apl. )clear clear out all functions and variables )vars list all variables )fns returns all functon names )shell executes bash shell )prws print contents of workspace in readable form )edit test edit function test )read test read function test )list test list function test alt shift s generates reversal ÷ alt shift h generates the ascending sort è alt shift g generates the descending sort ç alt shift o generates the natural log ð alt shift b gives execute â alt shift n gives format î alt shift - gives matrix inverse alt shift ' gives quotequad ì alt \ gives diamond þ (different from aplus) alt / gives reduce ¯ (first axis) alt = gives multiply « (different from aplus) alt - gives divide ß (different from aplus) alt 2 generates high minus ¢ alt 8 generates not equal ¨ alt 9 generates logical or © or monadic type alt 0 generates logical and ^ alt [ gives û operator alt shift [ gives ý operator alt e gives member Å alt g gives del Ç alt j gives jot Ê alt i gives interval É alt shift i gives ibeam à alt s gives ceiling Ó alt d gives floor Ä alt l gives box Ì alt r gives reshape Ò alt u gives drop Õ alt y gives take Ù alt m gives magnitude Í alt n gives encode Î alt b gives decode  alt v gives dot Ö control codes ------------- ctrl-c interrupt process ctrl-d logs off ctrl-u erases entire line ctrl-w erases word ctrl-i generates tab tab generates tab ctrl-j carriage return ctrl-m carriage return cursor keys do not work as expected backspace does not work as expected (use ctrl backspace instead) delete does not work as expected variables are case sensitive, e.g. r and R represent two different variables (É50)+50 returns the numbers 50 to 100 1 ^ 1 1 and 1 returns 1 ?3 returns a random number from 1 to 3 !5 returns factorial of 5 which is 120 3!5 returns the binomial (!B) divided by (!A) times !(B-A) which is 10 in this example (i.e. choose 3 from 5) 2!3 choose 2 from 3, which occurs in 3 ways «1 returns signum, ¢1 for negative, 0 for zero and 1 for positive m û 3 3 Ò É9 «/Ò m returns the number of elements of m m[2;2] returns 5 +/[1]m add up all the columns +/[2]m add up all the rows m < 0 returns which elements are less than zero m û 'gerbie power' 3 ÷ m returns bie powerger (rotates 3 characters to the left) 2 3 Ò 'abcdef' returns abc def a û 'apple' b û 'pear' c û a,b stores applepear in c 1 0 1 0 1 /'abcde' returns ace 1 1 1 1 1 / 4 returns 4 4 4 4 4 ' ' ¨ 'this is it' returns 1 1 1 1 0 1 1 0 1 1 'it''s' returns it's v û 1 2 3 4 5 v > 4 returns 0 0 0 0 1 v[1 2 5] returns 1 2 5 Ó/v returns largest element of v, i.e. 5 -v returns ­­¢1 ­¢2 ­¢3 ­¢4 ­¢5 (negates v) b û 'power of the gerbil' ­Ò b returns 19 (b = 'o') / ÉÒ b (returns positions of o) returns 2 7 (b Å 'aeiouy') / ÉÒ b returns 2 4 7 12 15 18 (returns positions of all vowels) v û 1 2 3 4 5 6 7 8 9 10 v Ê.« v returns tens times table 8 8 8  1 2 3 convert octal number 123 to decimal (returns 83) 8 8 8 Î 83 convert decimal number 83 to octal (returns 1 2 3) cû'3 4' +/âc returns character 7 x û 5 'the value of x is ',îx returns the value of x is 5 c û 'abcdef' 3Ùc returns abc a û 4 5 6 a [3 2 1] û a reorders a m û 3 4 ­Ò É12 m[2; ] returns 5 6 7 8 m[;3] returns all rows, column 3 i.e. 3 7 11 ß/1 2 3 4 5 finds alternating product, i.e. 1«3«5ß(2«4) = 1.875 Ìûxû5*3 assign 5*3 to x and display x Ìnc 'v' returns 2 (symbol is a label or variable) Ìav atomic vector which displays all symbols Ìio display origin Ìioû1 set origin to 1 Ìai account information, displays user id Ìct displays the comparison tolerance Ìlx latent expression executed on activation of workspace Ìpp printing precision, number of digits of precision Ìpw printing width, default is 72 Ìts time stamp, displays year, month, day, hour, minutes, seconds and milliseconds Ìrun 'ps -efw' run any unix command ibeams ------ 5 à35 sleep for 5 seconds functions --------- boxit 1 7 shape 'wowzers' prints wowzers horizontally boxed by asterisks fib 12 prints the first 12 numbers of the fibonacci series +/ fib 12 sum the first 12 numbers of the fibonacci series prime 100 prints prime numbers less than or equal to 100 (rather slow) prime1 100 prints prime numbers less than or equal to 100 uses sieve of eratosthene (much faster than prime) +/ prime1 100 sum all the primes less than or equal to 100