Word ladder: Difference between revisions

m
(→‎{{header|Julia}}: variable names)
Line 38:
 
=={{header|Julia}}==
<lang julia>const dict = DictSet(word => length(word) for word in split(read("unixdict.txt", String), r"\s+"))
 
function targeted_mutations(str::AbstractString, target::AbstractString)
Line 49:
for j in 1:length(s), c in 'a':'z'
w = s[1:j-1] * c * s[j+1:end]
if haskey(dict, w) in dict && w != s && !(w in tried)
push!(newworking, [arr; w])
end
4,105

edits