💾 Archived View for blitter.com › apl-examples › anagram › anagram-example.apl.txt captured on 2023-06-14 at 15:55:20.
⬅️ Previous capture (2023-05-24)
-=-=-=-=-=-=-
#!/usr/bin/env apl --script word←'listen' candidates←'enlists' 'google' 'inlets' 'banana' 'tinsel' ∇r ← word is_anagram_of other r ← word[⍋word] ≡ other[⍋other] ∇ ((⊂word) is_anagram_of ¨ candidates)/candidates ⍝⍝ NB. GNU APL also supports 'dfns' (simple lambdas). An equivalent ⍝⍝ solution using dfn syntax: ⍝⍝ ((⊂word) {⍺[⍋⍺] ≡ ⍵[⍋⍵]} ¨ candidates)/candidates