APL Wiki logo: Difference between revisions

Jump to navigation Jump to search
658 bytes added ,  15:24, 5 November 2019
Miraheze>Adám Brudzewsky
Miraheze>Adám Brudzewsky
Line 182: Line 182:
└───┴───┴───┴───┴───┘
└───┴───┴───┴───┴───┘
</source>
</source>
Now we take each coordinate (i.e. each [[rank]] 0 cell) from that and use it to [[Squad index|index]] into the list (a [[rank]] 1 array) of offsets. The result is has shape…
Now we take each coordinate (i.e. each [[rank]] 0 sub-array) from that and use it to [[Squad index|index]] (<source lang=apl inline>⌷</source>) into the list (a [[rank]] 1 array) of offsets. The result is has shape…
<source lang=apl>
<source lang=apl>
       ⍴xy←indices⌷⍤0 1⊢offsets
       ⍴xy←indices⌷⍤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. Each row 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. 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. The <source lang=apl inline>⊢</source> doesn't do anything other than separate <source lang=apl inline>0 1</source> from <source lang=apl inline>offsets</source>, so the <source lang=apl inline>⍤</source> knows what is its right [[operand]] (which specifies on what sub-arrays the function left operand is to be called) and what is its right [[argument]] (which contains the arguments for that function in its sub-arrays).
 
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↑xy) (¯1↑xy)
       (1↑xy) (¯1↑xy)
Line 202: Line 204:
<source lang=apl>
<source lang=apl>
</source>
</source>
=== Making <code><circle/></code> tags ===
=== Making <code><circle/></code> tags ===
To help us create our SVG <code><circle/></code> tags, well set up a couple of helper functions. The first function will help us create tag attributes.
To help us create our SVG <code><circle/></code> tags, well set up a couple of helper functions. The first function will help us create tag attributes.

Navigation menu