APL Wiki logo: Difference between revisions

Jump to navigation Jump to search
10 bytes removed ,  00:19, 26 July 2020
(make svg flat)
Line 334: Line 334:
We can do in-place concatenations to add all the circle tags and the closing tag:
We can do in-place concatenations to add all the circle tags and the closing tag:
<source lang=apl>
<source lang=apl>
       svg,←∊circles
       100↑svg,←∊circles
<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>'
       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="
</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).

Navigation menu