Updated 2012-10-08 16:06:21 by RLE

Richard Suchenwirth 2001-01-17 - When playing APL in Tcl, I wanted to display the real APL symbols (which are sometimes very special). Hunting the web for transliterations between APL and ASCII, I soon found Jim Weigang's APLASCII [1] which looked good to me: he represents any NON-ASCII characters with braced strings. Here's my initial and incomplete converter - it will grow over time, but if you desperately need it, just grab it now ;-) If called with no arguments aplish performs a little self-test.

A free TrueType font, "SImPL", with APL and many alphabet signs, can be downloaded at [2].
 proc aplish {{s {}}} {
    if {$s==""} {
        set s "L{<-}(L{iota}':'){drop}L{<-},L @ x{epsilon}y{and}z>0"
    regsub -all {\{\{} $s \x81 s ;# protect double braces
    regsub -all {\}\}} $s \x82 s
    foreach {a u} {
        <-    \u2190
        ->    \u2192
        <=    \u2264
        >=    \u2265
        /=    \u2260
        and   \u22C0
        delta \u0394
        drop  \u2193
        epsilon \u220a
        iota \u03b9
        max  \u2308
        min  \u230A
        neg  \u203e
        or   \u22C1
        rho  \u03C1
        rotate \u233d
        take \u2191
    } {
        regsub -all "\\{$a\\}" $s $u s
    regsub -all @ $s \u235d  s
    regsub -all {\x81} $s \{ s
    regsub -all {\x82} $s \} s
    set s

See The Lish family for more natural language converters, and An APL playstation where APLish is used.

AMG I put an extra set of braces around the argument list. "proc {s {}} {...}" means two arguments named s and {}, the second of which is considered illegal due to being an empty string. (Why?) But we want instead for the empty string to be s's default value. For this usage proc should get an argument list with one element which is itself a list of two elements, s and {}. RS: Oops, yes.. thanks! I've had that before: first I developed code, tested it, wikified it; then I later thought of another feature, tested it locally, and if satisfied, manually edited it into the Wiki page - and did not test again what I've done there. Sorry!