APL Wiki logo: Difference between revisions

Jump to navigation Jump to search
175 bytes removed ,  21:49, 7 January 2020
Line 203: Line 203:
4 1
4 1
</source>
</source>
Since we want the offsets paird up with themselves, we can use <source lang=apl inline>⍨</source> again:
Since we want the offsets paired up with themselves, we can use <source lang=apl inline>⍨</source> again:
<source lang=apl>
<source lang=apl>
             ,⍤0⍤0 1⍨⍳3
             ,⍤0⍤0 1⍨⍳3
Line 219: Line 219:
</source>
</source>
The offset pairs form our circle locations:
The offset pairs form our circle locations:
       ⍴locs←indices⌷⍤0 1⊢offsets
       ⍴locs←,⍤0⍤0 1⍨offsets
5 5 2
5 5 2
</source>
</source>
that is, it is a 3D array with 5 layers, 5 rows in each layer, and 2 columns in each row. The [[Rank operator]] (<source lang=apl inline>⍤</source>) allows me to specify that I want rank 0 sub-arrays on the left paired up with rank-1 sub-arrays on the right. Each row of our result represents an <math>(x,y)</math> value. The first and last layers, which represents the leftmost and rightmost columns of the logo, are:
that is, it is a 3D array with 5 layers, 5 rows in each layer, and 2 columns in each row. Each row of our result represents an <math>(x,y)</math> value. The first and last layers, which represents the leftmost and rightmost columns of the logo, are:
<source lang=apl>
<source lang=apl>
       (1↑locs) (¯1↑locs)
       (1↑locs) (¯1↑locs)

Navigation menu