Playfair cipher: Difference between revisions

Content added Content deleted
(→‎{{header|J}}: tacit version of dedouble)
(→‎{{header|J}}: simplify dedouble)
Line 751: Line 751:


restrict=: ] -. -.~
restrict=: ] -. -.~

getidx=: 1 >:@+:@i.~ =/"1@(_2 ]\ ]) NB. index of digraph with repeated letter
splitDigraph=: ({. , 'X' , }.)~ getidx NB. split first digraphs with repeated letter
splitDigraph=: ,`([,'X',])@.((= {.) *. 2 | #@])
dedouble=: dtb@:(>:@# {. splitDigraph)^:_ NB. split digraphs until until no change
dedouble=: splitDigraph/&.|. NB. progressively split digraphs in string


choose 'Q'
choose 'Q'