trusted
69
edits
Miraheze>Marshall (→Idiom Library Listing: More source tags in headers) |
m (→Rotate ⌽ ⊖) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[File:FinnAPL.jpg|thumb|The original FinnAPL idiom library]] | [[File:FinnAPL.jpg|thumb|The original FinnAPL idiom library]] | ||
The '''[[FinnAPL]] idiom library''' | The '''[[FinnAPL]] idiom library''' contains a collection of over 700 one-line APL idioms to accomplish a large variety of tasks. It was first presented at the 1984 [[APL conference]] in Helsinki, Finland. The huge contribution of the Finnish APL Association is gratefully acknowledged. | ||
This listing mainly suffers from two issues: | This listing mainly suffers from two issues: | ||
* Due to its age, it | * Due to its age, it doesn't make use of modern APL features which can provide a simpler solution. (However, a simple-looking expression which uses [[nested arrays]] might be far more computationally expensive than a longer, more involved solution which only uses simple arrays.) | ||
* It can be hard to find what one is looking for, both because computing terminology has changed, and because pinpointing the exact term can be difficult. | * It can be hard to find what one is looking for, both because computing terminology has changed, and because pinpointing the exact term can be difficult. | ||
[[APLcart]] includes all of the below library, updated to use the latest language features, and in an easily searchable format that includes modern day synonyms. | [[APLcart]] includes all of the below library, updated to use the latest language features, and in an easily searchable format that includes modern day synonyms. | ||
Line 198: | Line 198: | ||
|colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(X,'*')[(⎕IO+⍴X)⌊⍋(⍳⍴X),(Y×⍴G)⍴G]</source> | |colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(X,'*')[(⎕IO+⍴X)⌊⍋(⍳⍴X),(Y×⍴G)⍴G]</source> | ||
|- style="background-color: #FFFFFF" | |- style="background-color: #FFFFFF" | ||
|rowspan=2| 36. || Median ||style="text-align: right;"|<source lang=apl inline>X←D1</source> | |rowspan=2| 36. || Median<ref>Note: it doesn't average the middle two elements as per median's definition. A more correct idiomatic expression is <source lang=apl inline>0.5×+/X[(⍋X)[|⌈¯0.5 0.5×1+⍴X]]</source></ref> ||style="text-align: right;"|<source lang=apl inline>X←D1</source> | ||
|- style="background-color: #FFFFFF" | |- style="background-color: #FFFFFF" | ||
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>X[(⍋X)[⌈.5×⍴X]]</source> | |colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>X[(⍋X)[⌈.5×⍴X]]</source> | ||
Line 2,019: | Line 2,019: | ||
|colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(¯1⌽1↓(X≠¯1⌽X),1)/X</source> | |colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(¯1⌽1↓(X≠¯1⌽X),1)/X</source> | ||
|- style="background-color: #FFFFFF" | |- style="background-color: #FFFFFF" | ||
|rowspan=2| 491. || An expression giving itself ||style="text-align: right;"|<source lang=apl inline></source> | |rowspan=2| 491. || [[Quine|An expression giving itself]] ||style="text-align: right;"|<source lang=apl inline></source> | ||
|- style="background-color: #FFFFFF" | |- style="background-color: #FFFFFF" | ||
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>1⌽22⍴11⍴'''1⌽22⍴11⍴'''</source> | |colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>1⌽22⍴11⍴'''1⌽22⍴11⍴'''</source> | ||
Line 3,039: | Line 3,039: | ||
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>⍎⊖⍕⊃⊂|⌊-*+○⌈×÷!⌽⍉⌹~⍴⍋⍒,⍟?⍳0</source> | |colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>⍎⊖⍕⊃⊂|⌊-*+○⌈×÷!⌽⍉⌹~⍴⍋⍒,⍟?⍳0</source> | ||
|} | |} | ||
== Notes == | |||
<references/> | |||
[[Category:Lists]][[Category:Publications]] |