Simple examples: Difference between revisions

Jump to navigation Jump to search
850 bytes added ,  10:52, 7 November 2019
Miraheze>RikedyP
No edit summary
Miraheze>RikedyP
Line 141: Line 141:
</source>
</source>
{{Works in|all APLs}}
{{Works in|all APLs}}
=== Grille cypher ===
A grille is a 500 year old method for encrypting messages.
[[File:Grille.png|none|500px|frameless|left|The application of a grille cypher]]
<p>
Represent both the grid of letters and the grille as character matrices.
<source lang=apl>
      ⎕←(grid grille)←5 5∘⍴¨'VRYIALCLQIFKNEVPLARKMPLFF' '⌺⌺⌺ ⌺ ⌺⌺⌺ ⌺ ⌺ ⌺⌺⌺ ⌺⌺⌺  ⌺⌺'
┌─────┬─────┐
│VRYIA│⌺⌺⌺ ⌺│
│LCLQI│ ⌺⌺⌺ │
│FKNEV│⌺ ⌺ ⌺│
│PLARK│⌺⌺ ⌺⌺│
│MPLFF│⌺  ⌺⌺│
└─────┴─────┘
</source>
</p>
Retrieve elements of the grid where there are spaces in the grille.
<source lang=apl>
      grid[⍸grille=' ']
ILIKEAPL
</source>
An alternative method using [[ravel]].
<source lang=apl>
      (' '=,grille)/,grid
ILIKEAPL
</source>
{{APL programming language}}
{{APL programming language}}
Anonymous user

Navigation menu