[Tutor] What are these two string-formatting styles called?

Steven D'Aprano steve at pearwood.info
Fri Jun 14 19:56:34 CEST 2013


On 15/06/13 03:32, Jim Mooney wrote:

> Now you're going to tell me there's a programmer's keyboard ;')

http://en.wikipedia.org/wiki/Space-cadet_keyboard

http://upload.wikimedia.org/wikipedia/commons/4/47/Space-cadet.jpg


http://ageinghacker.net/hacks/apl-keyboard/apl-keyboard-2.jpg

http://www.rexswain.com/aplinfo.html


APL is a real programming language, and no, it was not intended as a joke. Here's an APL program to print letter diamonds like this:

    A
   B B
  C   C
   B B
    A


And here is the code:

mat⍪1 0↓⊖mat←(⌽mat),0 1↓mat←⊃(-⍳⍴letters)↑¨letters←(⎕A⍳'E')↑⎕A


http://aplwiki.com/Studio/LetterDiamonds




-- 
Steven


More information about the Tutor mailing list