4,494
edits
m (4 revisions imported: Migrate from miraheze) |
m (Text replacement - " ⊢( *[^∘])" to " ⎕←$1") |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
== Dyalog '19 version == | == Dyalog '19 version == | ||
Marshall Lochbaum showed the following code in a presentation (D04: "Tacit Techniques with Dyalog version 18.0 Operators"; video [https://dyalog.tv/Dyalog19/?v=czWC4tjwzOQ here]) at the [https://www.dyalog.com/user-meetings/dyalog19.htm Dyalog '19] user meeting. | [[Marshall Lochbaum]] showed the following code in a presentation (D04: "Tacit Techniques with Dyalog version 18.0 Operators"; video [https://dyalog.tv/Dyalog19/?v=czWC4tjwzOQ here]) at the [https://www.dyalog.com/user-meetings/dyalog19.htm Dyalog '19] user meeting. | ||
<source lang=apl> | <source lang=apl> | ||
handrank←{⊃{((8|@1⊢2-/⍺)⍵∧.=¨1,⊃⍵){(∧/⍺),(2=≢⍵),⍺,⊂⍵[⍒⍵;]⊖⍨⊃⍺},⍨∘≢⌸⍺}/↓⍉⍵[⍒⍵;]} | handrank←{⊃{((8|@1⊢2-/⍺)⍵∧.=¨1,⊃⍵){(∧/⍺),(2=≢⍵),⍺,⊂⍵[⍒⍵;]⊖⍨⊃⍺},⍨∘≢⌸⍺}/↓⍉⍵[⍒⍵;]} | ||
Line 113: | Line 113: | ||
<source lang=apl> | <source lang=apl> | ||
r s ← ↓⍉sort hand 'A♠2♠3♣4♠5♢' | r s ← ↓⍉sort hand 'A♠2♠3♣4♠5♢' | ||
⎕←ranks ← sort {(≢⍵),⍺}⌸ r | |||
1 13 | 1 13 | ||
1 4 | 1 4 | ||
Line 119: | Line 119: | ||
1 2 | 1 2 | ||
1 1 | 1 1 | ||
⎕←sf ← (8|@1⊢2-/r)s∧.=¨1,⊃s | |||
1 0 | 1 0 | ||
</source> | </source> | ||
Line 227: | Line 227: | ||
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 | ||
</source> | </source> | ||
[[Category:Examples]][[Category:Dyalog APL examples]] |