Main Page: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Text replacement - "<source" to "<syntaxhighlight") Tags: Mobile edit Mobile web edit |
||
Line 42: | Line 42: | ||
APL's terseness means that substantial programs are expressible in a small space, relative to many other programming languages. Below are just a taste. Many more, and fully explained, examples are in the [[simple examples]] article. | APL's terseness means that substantial programs are expressible in a small space, relative to many other programming languages. Below are just a taste. Many more, and fully explained, examples are in the [[simple examples]] article. | ||
=== Split text by delimiter === | === Split text by delimiter === | ||
With the introduction of [[tacit programming]], many functions can be expressed in fewer characters than even the shortest fitting name. For example < | With the introduction of [[tacit programming]], many functions can be expressed in fewer characters than even the shortest fitting name. For example <syntaxhighlight lang=apl inline>≠⊆⊢</source> is but three characters, while you would need five for the name <code>Split</code>: | ||
[https://tryapl.org/?a=%27%2C%27%28%u2260%u2286%u22A2%29%27comma%2Cdelimited%2Ctext%27&run Try it now!] | [https://tryapl.org/?a=%27%2C%27%28%u2260%u2286%u22A2%29%27comma%2Cdelimited%2Ctext%27&run Try it now!] | ||
< | <syntaxhighlight lang=apl> | ||
','(≠⊆⊢)'comma,delimited,text' | ','(≠⊆⊢)'comma,delimited,text' | ||
┌─────┬─────────┬────┐ | ┌─────┬─────────┬────┐ | ||
Line 58: | Line 58: | ||
[https://tryapl.org/?a=%u22A2world%u21902%202%202%202%u22A40%2012%205%202%204%201&run&a=%7B%u21911%20%u2375%u2228.%u22273%204%3D+/%2C%AF1%200%201%u2218.%u2296%AF1%200%201%u2218.%u233D%u2282%u2375%7D%20world&run Try it now!] | [https://tryapl.org/?a=%u22A2world%u21902%202%202%202%u22A40%2012%205%202%204%201&run&a=%7B%u21911%20%u2375%u2228.%u22273%204%3D+/%2C%AF1%200%201%u2218.%u2296%AF1%200%201%u2218.%u233D%u2282%u2375%7D%20world&run Try it now!] | ||
< | <syntaxhighlight lang=apl> | ||
⎕←world←2 2 2 2⊤0 12 5 2 4 1 | ⎕←world←2 2 2 2⊤0 12 5 2 4 1 | ||
0 1 0 0 0 0 | 0 1 0 0 0 0 |