Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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