move a few things away in to-be-integrated/
[myslice.git] / to-be-integrated / third-party / codemirror-3.15 / mode / apl / index.html
1 <!doctype html>
2 <html>
3   <head>
4     <meta charset="utf-8">
5     <title>CodeMirror: APL mode</title>
6     <link rel="stylesheet" href="../../doc/docs.css"> 
7     <link rel="stylesheet" href="../../lib/codemirror.css"> 
8     <script src="../../lib/codemirror.js"></script>
9     <script src="../../addon/edit/matchbrackets.js"></script>
10     <script src="./apl.js"></script>
11     <style>
12         .CodeMirror { border: 2px inset #dee; }
13     </style>
14   </head>
15   <body>
16     <h1>CodeMirror: APL mode</h1>
17
18 <form><textarea id="code" name="code">
19 ⍝ Conway's game of life
20
21 ⍝ This example was inspired by the impressive demo at
22 ⍝ http://www.youtube.com/watch?v=a9xAKttWgP4
23
24 ⍝ Create a matrix:
25 ⍝     0 1 1
26 ⍝     1 1 0
27 ⍝     0 1 0
28 creature ← (3 3 ⍴ ⍳ 9) ∈ 1 2 3 4 7   ⍝ Original creature from demo
29 creature ← (3 3 ⍴ ⍳ 9) ∈ 1 3 6 7 8   ⍝ Glider
30
31 ⍝ Place the creature on a larger board, near the centre
32 board ← ¯1 ⊖ ¯2 ⌽ 5 7 ↑ creature
33
34 ⍝ A function to move from one generation to the next
35 life ← {∨/ 1 ⍵ ∧ 3 4 = ⊂+/ +⌿ 1 0 ¯1 ∘.⊖ 1 0 ¯1 ⌽¨ ⊂⍵}
36
37 ⍝ Compute n-th generation and format it as a
38 ⍝ character matrix
39 gen ← {' #'[(life ⍣ ⍵) board]}
40
41 ⍝ Show first three generations
42 (gen 1) (gen 2) (gen 3)
43 </textarea></form>
44
45     <script>
46       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
47         lineNumbers: true,
48         matchBrackets: true,
49         mode: "text/apl"
50       });
51     </script>
52
53     <p>Simple mode that tries to handle APL as well as it can.</p>
54     <p>It attempts to label functions/operators based upon
55     monadic/dyadic usage (but this is far from fully fleshed out).
56     This means there are meaningful classnames so hover states can
57     have popups etc.</p>
58
59     <p><strong>MIME types defined:</strong> <code>text/apl</code> (APL code)</p>
60   </body>
61 </html>