APL Wiki logo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 185: | Line 185: | ||
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 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 has shape… | ||
<source lang=apl> | <source lang=apl> | ||
⍴locs←indices⌷⍤0 1⊢offsets | |||
5 5 2 | 5 5 2 | ||
</source> | </source> | ||
Line 192: | Line 192: | ||
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: | 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) | ||
┌────┬─────┐ | ┌────┬─────┐ | ||
│0 0│42 0│ | │0 0│42 0│ | ||
Line 252: | Line 252: | ||
Notice that a put in <source lang=apl inline>⊂</source>) which [[enclose]]s the result. This is because I want to deal with these tags a [[scalar]] elements. Now we can create our circles (and show the first three: | Notice that a put in <source lang=apl inline>⊂</source>) which [[enclose]]s the result. This is because I want to deal with these tags a [[scalar]] elements. Now we can create our circles (and show the first three: | ||
<source lang=apl> | <source lang=apl> | ||
3↑circles←, | 3↑circles←,Circle⍤1⊢locs,sizes | ||
┌─────────────────────────────┬─────────────────────────────┬──────────────────────────────┐ | ┌─────────────────────────────┬─────────────────────────────┬──────────────────────────────┐ | ||
│<circle cx="0" cy="0" r="1"/>│<circle cx="0" cy="9" r="2"/>│<circle cx="0" cy="21" r="3"/>│ | │<circle cx="0" cy="0" r="1"/>│<circle cx="0" cy="9" r="2"/>│<circle cx="0" cy="21" r="3"/>│ |