4,493
edits
EllisMorgan (talk | contribs) m (→Code) |
(make svg flat) |
||
Line 335: | Line 335: | ||
<source lang=apl> | <source lang=apl> | ||
svg,←∊circles | svg,←∊circles | ||
100↑svg | svg,←'</svg>' | ||
100↑svg | |||
<circle cx="0" cy="0" r="1"/><circle cx="0" cy="9" r="2"/><circle cx="0" cy="21" r="3"/><circle cx=" | <circle cx="0" cy="0" r="1"/><circle cx="0" cy="9" r="2"/><circle cx="0" cy="21" r="3"/><circle cx=" | ||
</source> | </source> | ||
You may recognise the pattern here as [[wikipedia:augmented assignment|augmented assignment]] from C and related programming languages. APL allows you to use any function to modify values in-place. If you are not familiar with this, then just think of <source lang=apl inline>name,←value</source> as <source lang=apl inline>name←name,value</source> (but the pass-though value is whatever is on the right of the assignment arrow). | You may recognise the pattern here as [[wikipedia:augmented assignment|augmented assignment]] from C and related programming languages. APL allows you to use any function to modify values in-place. If you are not familiar with this, then just think of <source lang=apl inline>name,←value</source> as <source lang=apl inline>name←name,value</source> (but the pass-though value is whatever is on the right of the assignment arrow). | ||
Line 353: | Line 353: | ||
[[File:)HTML rendering APL Wiki logo.png|frameless|]HTML rendering APL Wiki logo]] | [[File:)HTML rendering APL Wiki logo.png|frameless|]HTML rendering APL Wiki logo]] | ||
== Code == | == Code == | ||
{{Collapse|The function below contains all the code from above. It takes a file name as argument | {{Collapse|The function below contains all the code from above. It takes a file name as argument.| | ||
<source lang=apl> | <source lang=apl> | ||
Logo←{ | Logo←{ | ||
Line 373: | Line 373: | ||
viewBox←'viewBox'Attr,begin,size | viewBox←'viewBox'Attr,begin,size | ||
svg←'<svg',dims,viewBox,' xmlns="http://www.w3.org/2000/svg">' | |||
svg, | svg,←∊circles | ||
svg,←'</svg>' | |||
svg ⎕NPUT ⍵ | svg ⎕NPUT ⍵ | ||
} | } |