APL Wiki logo: Difference between revisions

Jump to navigation Jump to search
110 bytes removed ,  00:17, 26 July 2020
make svg flat
(make svg flat)
Line 335: Line 335:
<source lang=apl>
<source lang=apl>
       svg,←∊circles
       svg,←∊circles
       100↑svg,←∊circles
      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="
      svg,←'</svg>'
</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. (Please note one user of Dyalog 16.0 found it necessary to enclose the "svg" argument on the last line).|
{{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',dims,viewBox,' xmlns="http://www.w3.org/2000/svg">'
     svg,←circles,'</svg>'
     svg,←∊circles
    svg,'</svg>'
     svg ⎕NPUT ⍵
     svg ⎕NPUT ⍵
  }
  }

Navigation menu