apl: page to list common APL symbols and meanings
[sheet.git] / apl.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'APL',
5         version => 'v1.0',
6         description => [
7         ],
8         keywords => [qw'
9         '],
10         stylesheet => [qw'light circus dark red'],
11         data => [qw'apl.inc.pl'],
12 });
13
14 use Shiar_Sheet::FormatChar;
15 my $glyphs = Shiar_Sheet::FormatChar->new;
16
17 my @ops = do 'apl.inc.pl';
18 @ops > 1 or die "cannot open operator include: $@\n";
19
20 :>
21 <h1>APL Symbols</h1>
22
23 <div class="section">
24 <table class="mapped">
25 <thead><tr>
26         <td rowspan=2>op
27         <td colspan=2>input
28         <td colspan=2>meaning
29 <tr>
30         <td><a href="/digraphs" title="digraph">di</a><td>html
31         <td>monadic
32         <td>dyadic
33 </thead>
34
35
36 <:
37 for my $op (@ops) {
38         my ($chr, $monad, $dyad) = @{$op};
39         my $codepoint = ord $chr;
40         my $ascii = $codepoint <= 127;
41         my $info = $glyphs->glyph_info($codepoint);
42         my ($class, $name, $mnem, $html, $string) = @{$info};
43         printf '<tr><th title="%2$s">%s'."\n", $chr, EscapeHTML($name || '?'), $class;
44         printf '<td class="%s">%s', @{$_} for (
45                 [defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : $ascii ? 'l5' : 'l1',
46                         EscapeHTML($mnem) // sprintf('%s%0*X', $codepoint < 256 ? (x => 2) : (u => 4), $codepoint)],
47                 [defined $html ? 'l4' : $ascii ? 'l5' : 'l1', $html // "#$codepoint"],
48         );
49         printf(
50                 defined $_ ? '<td title="%2$s">%s' : '<td class="Xi">',
51                 map { EscapeHTML($_) } split /\n/, $_, 2
52         ) for $monad, $dyad;
53 }
54
55 :></table>
56 </div>
57
58 <hr>
59
60 <div class="legend">
61         <table class="glyphs"><tr>
62         <td class="X l5">unicode 1.1
63         <td class="X l4">20th century
64         <td class="X l3">in 6.0 (2010)
65         <td class="X l2">recent assignments
66         <td class="X l1">proposed
67         <td class="ex">irregular
68         </table>
69 </div>
70