Anagram generator: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 34:
Implementation:
 
<syntaxhighlight lang=J"j">anagen=: {{
seed=. (tolower y)([-.-.)a.{~97+i.26
letters=. ~.seed
Line 65:
Examples:
 
<syntaxhighlight lang=J"j"> 'unixdict.txt' anagen 'Rosettacode'
cetera stood
coat oersted
Line 138:
 
=={{header|Julia}}==
<syntaxhighlight lang="ruby">const unixwords = split(read("unixdict.txt", String) |> lowercase, r"\s+")
 
function findphrases(anastring::AbstractString, choices, sizelong = 4, n_shortpermitted = 1)
Line 210:
=={{header|Phix}}==
Couldn't really think of a better way than just building a dirty great filter list to get rid of the less interesting answers....
<!--<syntaxhighlight lang=Phix"phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">bo_ring</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"al"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"alex"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"am"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"an"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"and"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"anent"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"ann"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"ant"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"ar"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"ares"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"art"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"at"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"ax"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"axle"</span><span style="color: #0000FF;">,</span>
Line 318:
Using the unixdict.txt word file by default.
 
<syntaxhighlight lang=perl6"raku" line>unit sub MAIN ($in is copy = '', :$dict = 'unixdict.txt');
 
say 'Enter a word or phrase to be anagramed. (Loading dictionary)' unless $in.chars;
Line 382:
 
Alternatives formed by simply changing the order of the two words have been suppressed.
<syntaxhighlight lang="ecmascript">import "io" for File
import "./str" for Str, Char
import "./perm" for Comb
10,333

edits