FinnAPL idiom library: Difference between revisions

Jump to navigation Jump to search
→‎Grade Up ⍋: median example from "APL: An Interactive Approach" (3rd ed., 1984), per "APL thinking: examples" (1987)
No edit summary
(→‎Grade Up ⍋: median example from "APL: An Interactive Approach" (3rd ed., 1984), per "APL thinking: examples" (1987))
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<ref>Note: it doesn't average the middle two elements as per median's definition.</ref> ||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>
trusted
69

edits

Navigation menu