Words from neighbour ones: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
Line 29: Line 29:
{{trans|Python}}
{{trans|Python}}


<lang 11l>V wordList = File(‘unixdict.txt’).read().split("\n")
<syntaxhighlight lang="11l">V wordList = File(‘unixdict.txt’).read().split("\n")


V filteredWords = wordList.filter(chosenWord -> chosenWord.len >= 9)
V filteredWords = wordList.filter(chosenWord -> chosenWord.len >= 9)
Line 37: Line 37:
V newWord = (0..8).map(i -> :filteredWords[@position + i][i]).join(‘’)
V newWord = (0..8).map(i -> :filteredWords[@position + i][i]).join(‘’)
I newWord C filteredWords
I newWord C filteredWords
print(newWord)</lang>
print(newWord)</syntaxhighlight>


{{out}}
{{out}}
Line 76: Line 76:
=={{header|AppleScript}}==
=={{header|AppleScript}}==
===Core language===
===Core language===
<lang applescript>on task()
<syntaxhighlight lang="applescript">on task()
-- Since the task specifically involves unixdict.txt, this code's written in
-- Since the task specifically involves unixdict.txt, this code's written in
-- the knowlege that the words are on individual lines and in dictionary order.
-- the knowlege that the words are on individual lines and in dictionary order.
Line 116: Line 116:
end task
end task


task()</lang>
task()</syntaxhighlight>


{{output}}
{{output}}
<lang applescript>{"applicate", "architect", "astronomy", "christine", "christoph", "committee", "composite", "constrict", "construct", "different", "extensive", "greenwood", "implement", "improvise", "intercept", "interpret", "interrupt", "philosoph", "prescript", "receptive", "telephone", "transcend", "transport", "transpose"}</lang>
<syntaxhighlight lang="applescript">{"applicate", "architect", "astronomy", "christine", "christoph", "committee", "composite", "constrict", "construct", "different", "extensive", "greenwood", "implement", "improvise", "intercept", "interpret", "interrupt", "philosoph", "prescript", "receptive", "telephone", "transcend", "transport", "transpose"}</syntaxhighlight>


===AppleScriptObjC===
===AppleScriptObjC===
Same output as above.
Same output as above.
<lang applescript>use AppleScript version "2.4" -- OS X 10.10 (Yosemite) or later
<syntaxhighlight lang="applescript">use AppleScript version "2.4" -- OS X 10.10 (Yosemite) or later
use framework "Foundation"
use framework "Foundation"
use scripting additions
use scripting additions
Line 159: Line 159:
end task
end task


task()</lang>
task()</syntaxhighlight>


=={{header|Arturo}}==
=={{header|Arturo}}==
{{trans|Nim}}
{{trans|Nim}}
<lang rebol>wordset: map read.lines relative "unixdict.txt" => strip
<syntaxhighlight lang="rebol">wordset: map read.lines relative "unixdict.txt" => strip
wordset: select wordset 'word -> 9 =< size word
wordset: select wordset 'word -> 9 =< size word


Line 177: Line 177:
lastWord: new newWord
lastWord: new newWord
]
]
]</lang>
]</syntaxhighlight>


{{out}}
{{out}}
Line 207: Line 207:


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang AutoHotkey>FileRead, wList, % A_Desktop "\unixdict.txt"
<syntaxhighlight lang="autohotkey">FileRead, wList, % A_Desktop "\unixdict.txt"
for word in neighbour(wList)
for word in neighbour(wList)
result .= word (Mod(A_Index, 6) ? "`t" : "`n")
result .= word (Mod(A_Index, 6) ? "`t" : "`n")
Line 232: Line 232:
}
}
return oRes
return oRes
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>applicate architect astronomy christine christoph committee
<pre>applicate architect astronomy christine christoph committee
Line 240: Line 240:


=={{header|AWK}}==
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f WORDS_FROM_NEIGHBOUR_ONES.AWK unixdict.txt
# syntax: GAWK -f WORDS_FROM_NEIGHBOUR_ONES.AWK unixdict.txt
{ if (length($0) < 9) { next }
{ if (length($0) < 9) { next }
Line 260: Line 260:
exit(0)
exit(0)
}
}
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 289: Line 289:
</pre>
</pre>
=={{header|C}}==
=={{header|C}}==
<lang c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
Line 358: Line 358:
free(words);
free(words);
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 389: Line 389:


=={{header|C++}}==
=={{header|C++}}==
<lang cpp>#include <algorithm>
<syntaxhighlight lang="cpp">#include <algorithm>
#include <cstdlib>
#include <cstdlib>
#include <fstream>
#include <fstream>
Line 427: Line 427:
}
}
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 460: Line 460:
{{libheader| System.Classes}}
{{libheader| System.Classes}}
{{Trans|Java}}
{{Trans|Java}}
<syntaxhighlight lang="delphi">
<lang Delphi>
program Words_from_neighbour_ones;
program Words_from_neighbour_ones;


Line 512: Line 512:
Words.Free;
Words.Free;
readln;
readln;
end.</lang>
end.</syntaxhighlight>
{{out}}
{{out}}
<pre> 1. applicate
<pre> 1. applicate
Line 540: Line 540:


=={{header|F_Sharp|F#}}==
=={{header|F_Sharp|F#}}==
<lang fsharp>
<syntaxhighlight lang="fsharp">
// Words from neighbour ones. Nigel Galloway: February 11th., 2021.
// Words from neighbour ones. Nigel Galloway: February 11th., 2021.
let g=[|use n=System.IO.File.OpenText("unixdict.txt") in while not n.EndOfStream do yield n.ReadLine()|]|>Array.filter(fun n->n.Length>8)
let g=[|use n=System.IO.File.OpenText("unixdict.txt") in while not n.EndOfStream do yield n.ReadLine()|]|>Array.filter(fun n->n.Length>8)
g|>Array.windowed 9|>Array.map(fun n->n|>Array.mapi(fun n g->g.[n])|>System.String)|>Array.filter(fun n-> Array.contains n g)|>Array.distinct|>Array.iter(printfn "%s")
g|>Array.windowed 9|>Array.map(fun n->n|>Array.mapi(fun n g->g.[n])|>System.String)|>Array.filter(fun n-> Array.contains n g)|>Array.distinct|>Array.iter(printfn "%s")
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 578: Line 578:
<code><clumps></code> is the same idea except it doesn't actually store all that redundant information in memory; it's a generator that generates clumps on demand. Notice that clumps are matrices, so we can take their diagonal with <code>main-diagonal</code>.
<code><clumps></code> is the same idea except it doesn't actually store all that redundant information in memory; it's a generator that generates clumps on demand. Notice that clumps are matrices, so we can take their diagonal with <code>main-diagonal</code>.
{{works with|Factor|0.99 2020-08-14}}
{{works with|Factor|0.99 2020-08-14}}
<lang factor>USING: formatting grouping hash-sets io.encodings.ascii io.files
<syntaxhighlight lang="factor">USING: formatting grouping hash-sets io.encodings.ascii io.files
kernel literals math math.matrices sequences sequences.extras
kernel literals math math.matrices sequences sequences.extras
sets strings ;
sets strings ;
Line 592: Line 592:
[ wordset in? ] map-filter ! filter diagonals that are words
[ wordset in? ] map-filter ! filter diagonals that are words
members ! remove duplicates
members ! remove duplicates
[ 1 + swap "%2d. %s\n" printf ] each-index ! print words formatted nicely</lang>
[ 1 + swap "%2d. %s\n" printf ] each-index ! print words formatted nicely</syntaxhighlight>
{{out}}
{{out}}
<pre style="height:17em">
<pre style="height:17em">
Line 624: Line 624:
=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
{{trans|Ring}}
{{trans|Ring}}
<lang freebasic>
<syntaxhighlight lang="freebasic">
Open "unixdict.txt" For Input As #1
Open "unixdict.txt" For Input As #1
Dim As String cStr, wordList()
Dim As String cStr, wordList()
Line 674: Line 674:
Print !"\nterminado..."
Print !"\nterminado..."
Sleep
Sleep
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 714: Line 714:


=={{header|Go}}==
=={{header|Go}}==
<lang go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 760: Line 760:
}
}
}
}
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 791: Line 791:


=={{header|J}}==
=={{header|J}}==
<lang J> >(([-.-.)9 <@((=i.9)#&,])\ 9{.&>(#~ 8<#@>)) cutLF fread 'unixdict.txt'
<syntaxhighlight lang="j"> >(([-.-.)9 <@((=i.9)#&,])\ 9{.&>(#~ 8<#@>)) cutLF fread 'unixdict.txt'
applicate
applicate
architect
architect
Line 815: Line 815:
transcend
transcend
transport
transport
transpose</lang>
transpose</syntaxhighlight>


In other words: find the set intersection (<code>([-.-.)</code>) between words and the sequences of 9 ascending position characters (<code>9 <@((=i.9)#&,])\</code> ...) from extracting the first 9 characters (<code>9{.&></code> ...) of words with more than 8 characters (<code>(#~ 8<#@>)</code>) for words from unixdict.txt (( ... )<code>cutLF fread 'unixdict.txt'</code>)
In other words: find the set intersection (<code>([-.-.)</code>) between words and the sequences of 9 ascending position characters (<code>9 <@((=i.9)#&,])\</code> ...) from extracting the first 9 characters (<code>9{.&></code> ...) of words with more than 8 characters (<code>(#~ 8<#@>)</code>) for words from unixdict.txt (( ... )<code>cutLF fread 'unixdict.txt'</code>)


=={{header|Java}}==
=={{header|Java}}==
<lang java>import java.io.*;
<syntaxhighlight lang="java">import java.io.*;
import java.util.*;
import java.util.*;


Line 853: Line 853:
}
}
}
}
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 884: Line 884:


=={{header|JavaScript}}==
=={{header|JavaScript}}==
<lang javascript>
<syntaxhighlight lang="javascript">
document.write(`
document.write(`
<p>Choose dictionary: <input id="dict" type="file"></p>
<p>Choose dictionary: <input id="dict" type="file"></p>
Line 913: Line 913:
fr.readAsText(f);
fr.readAsText(f);
}
}
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 921: Line 921:
=={{header|jq}}==
=={{header|jq}}==


For speed, this solution constructs a JSON object as a dictionary ($hash):<lang jq>
For speed, this solution constructs a JSON object as a dictionary ($hash):<syntaxhighlight lang="jq">
# input: the dictionary
# input: the dictionary
# $n: starting point (starting at 0)
# $n: starting point (starting at 0)
Line 931: Line 931:
| . as $dict
| . as $dict
| (reduce.[] as $x ({}; .[$x]=true)) as $hash
| (reduce.[] as $x ({}; .[$x]=true)) as $hash
| range(0; length-9) as $i | form_word($i) | select($hash[.])</lang>
| range(0; length-9) as $i | form_word($i) | select($hash[.])</syntaxhighlight>
{{out}}
{{out}}
<pre>["applicate","architect","astronomy","christine","christoph","committee","committee","committee","committee","committee","composite","constrict","constrict","construct","different","extensive","greenwood","implement","improvise","intercept","interpret","interrupt","interrupt","philosoph","prescript","receptive","telephone","transcend","transcend","transport","transpose"]
<pre>["applicate","architect","astronomy","christine","christoph","committee","committee","committee","committee","committee","composite","constrict","constrict","construct","different","extensive","greenwood","implement","improvise","intercept","interpret","interrupt","interrupt","philosoph","prescript","receptive","telephone","transcend","transcend","transport","transpose"]
Line 938: Line 938:
====Removing duplicates efficiently====
====Removing duplicates efficiently====
Using `def form_word`, we have only to modify the last line above:
Using `def form_word`, we have only to modify the last line above:
<lang jq>[inputs | select(length >= 9)]
<syntaxhighlight lang="jq">[inputs | select(length >= 9)]
| . as $dict
| . as $dict
| (reduce.[] as $x ({}; .[$x]=true)) as $hash
| (reduce.[] as $x ({}; .[$x]=true)) as $hash
Line 944: Line 944:
($dict | form_word($i)) as $w
($dict | form_word($i)) as $w
| if .hash[$w] then .hash[$w] = null | .words += [$w] else . end)
| if .hash[$w] then .hash[$w] = null | .words += [$w] else . end)
| .words</lang>
| .words</syntaxhighlight>


=={{header|Julia}}==
=={{header|Julia}}==
<lang julia>function wordsfromneighbourones(wordfile::String, len = 9, colwidth = 11, numcols = 8)
<syntaxhighlight lang="julia">function wordsfromneighbourones(wordfile::String, len = 9, colwidth = 11, numcols = 8)
println("Word source: $wordfile\n")
println("Word source: $wordfile\n")
words = filter(w -> length(w) >= len, split(read(wordfile, String), r"\s+"))
words = filter(w -> length(w) >= len, split(read(wordfile, String), r"\s+"))
Line 961: Line 961:


wordsfromneighbourones("unixdict.txt")
wordsfromneighbourones("unixdict.txt")
</lang>{{out}}
</syntaxhighlight>{{out}}
<pre>
<pre>
Word source: unixdict.txt
Word source: unixdict.txt
Line 971: Line 971:


=={{header|Ksh}}==
=={{header|Ksh}}==
<lang ksh>
<syntaxhighlight lang="ksh">
#!/bin/ksh
#!/bin/ksh


Line 1,027: Line 1,027:
fi
fi
fi
fi
done</lang>
done</syntaxhighlight>
{{out}}<pre>
{{out}}<pre>
1 applicate
1 applicate
Line 1,055: Line 1,055:


=={{header|Lua}}==
=={{header|Lua}}==
<lang lua>wordlist, wordhash = {}, {}
<syntaxhighlight lang="lua">wordlist, wordhash = {}, {}
for word in io.open("unixdict.txt", "r"):lines() do
for word in io.open("unixdict.txt", "r"):lines() do
if #word >= 9 then
if #word >= 9 then
Line 1,073: Line 1,073:
print(word)
print(word)
end
end
end</lang>
end</syntaxhighlight>
{{out}}
{{out}}
<pre>applicate
<pre>applicate
Line 1,108: Line 1,108:


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>dict = Once[Import["https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt"]];
<syntaxhighlight lang="mathematica">dict = Once[Import["https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt"]];
dict //= StringSplit[#,"\n"]&;
dict //= StringSplit[#,"\n"]&;
dict //= Select[StringLength/*GreaterEqualThan[9]];
dict //= Select[StringLength/*GreaterEqualThan[9]];
firsts9 = Characters[dict][[All,;;9]];
firsts9 = Characters[dict][[All,;;9]];
words = StringJoin[Diagonal[firsts9,-#]]&/@Range[0,Length[firsts9]-9];
words = StringJoin[Diagonal[firsts9,-#]]&/@Range[0,Length[firsts9]-9];
Intersection[words,dict]</lang>
Intersection[words,dict]</syntaxhighlight>
{{out}}
{{out}}
<pre>{"applicate", "architect", "astronomy", "christine", "christoph", "committee", "composite", "constrict", "construct", "different", "extensive", "greenwood", "implement", "improvise", "intercept", "interpret", "interrupt", "philosoph", "prescript", "receptive", "telephone", "transcend", "transport", "transpose"}</pre>
<pre>{"applicate", "architect", "astronomy", "christine", "christoph", "committee", "composite", "constrict", "construct", "different", "extensive", "greenwood", "implement", "improvise", "intercept", "interpret", "interrupt", "philosoph", "prescript", "receptive", "telephone", "transcend", "transport", "transpose"}</pre>


=={{header|Nim}}==
=={{header|Nim}}==
<lang Nim>import sets, strutils, sugar
<syntaxhighlight lang="nim">import sets, strutils, sugar


# Build list and set of words with length >= 9.
# Build list and set of words with length >= 9.
Line 1,135: Line 1,135:
inc count
inc count
echo ($count).align(2), ' ', newWord
echo ($count).align(2), ' ', newWord
lastWord = newWord</lang>
lastWord = newWord</syntaxhighlight>


{{out}}
{{out}}
Line 1,164: Line 1,164:


=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>#!/usr/bin/perl
<syntaxhighlight lang="perl">#!/usr/bin/perl


use strict; # https://rosettacode.org/wiki/Words_from_neighbour_ones
use strict; # https://rosettacode.org/wiki/Words_from_neighbour_ones
Line 1,178: Line 1,178:
my $new = join '', @{^CAPTURE}, "\n";
my $new = join '', @{^CAPTURE}, "\n";
$dict{$new} and !$seen{$new}++ and print $new;
$dict{$new} and !$seen{$new}++ and print $new;
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
applicate
applicate
Line 1,206: Line 1,206:


=={{header|Phix}}==
=={{header|Phix}}==
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">over9</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">word</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">word</span><span style="color: #0000FF;">)>=</span><span style="color: #000000;">9</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">over9</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">word</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">word</span><span style="color: #0000FF;">)>=</span><span style="color: #000000;">9</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
Line 1,213: Line 1,213:
<span style="color: #004080;">sequence</span> <span style="color: #000000;">neighwords</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">unique</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">columnize</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">9</span><span style="color: #0000FF;">),</span><span style="color: #000000;">slicen</span><span style="color: #0000FF;">)),</span><span style="color: #008000;">"in"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">words</span><span style="color: #0000FF;">))</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">neighwords</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">unique</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">columnize</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">9</span><span style="color: #0000FF;">),</span><span style="color: #000000;">slicen</span><span style="color: #0000FF;">)),</span><span style="color: #008000;">"in"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">words</span><span style="color: #0000FF;">))</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d words: %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">neighwords</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">shorten</span><span style="color: #0000FF;">(</span><span style="color: #000000;">neighwords</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">))})</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d words: %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">neighwords</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">shorten</span><span style="color: #0000FF;">(</span><span style="color: #000000;">neighwords</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">))})</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
{{out}}
{{out}}
<pre>
<pre>
Line 1,220: Line 1,220:


=={{header|Processing}}==
=={{header|Processing}}==
<lang Processing>StringList words = new StringList(), found = new StringList();
<syntaxhighlight lang="processing">StringList words = new StringList(), found = new StringList();
for (String str : loadStrings("unixdict.txt")) {
for (String str : loadStrings("unixdict.txt")) {
if (str.length() >= 9) {
if (str.length() >= 9) {
Line 1,237: Line 1,237:
for (String word : found) {
for (String word : found) {
println(word);
println(word);
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre style="height: 18em;">applicate
<pre style="height: 18em;">applicate
Line 1,267: Line 1,267:
=={{header|Python}}==
=={{header|Python}}==
Tested on Python 3+, the file download will work only if the link is still active. It is possible that you may be able to fetch the file in your browser but download via code may still fail. Check whether you are connected to a VPN, it works on open networks.
Tested on Python 3+, the file download will work only if the link is still active. It is possible that you may be able to fetch the file in your browser but download via code may still fail. Check whether you are connected to a VPN, it works on open networks.
<syntaxhighlight lang="python">
<lang Python>
#Aamrun, 5th November 2021
#Aamrun, 5th November 2021


Line 1,288: Line 1,288:
if newWord in filteredWords:
if newWord in filteredWords:
print(newWord)
print(newWord)
</syntaxhighlight>
</lang>
{{Output}}
{{Output}}
Yes, there are duplicates, the task doesn't say that only unique elements should be present, hence the complete raw list will appear as below :
Yes, there are duplicates, the task doesn't say that only unique elements should be present, hence the complete raw list will appear as below :
Line 1,326: Line 1,326:


=={{header|Raku}}==
=={{header|Raku}}==
<lang perl6>my @words_ge_9 = 'unixdict.txt'.IO.lines.grep( *.chars >= 9 );
<syntaxhighlight lang="raku" line>my @words_ge_9 = 'unixdict.txt'.IO.lines.grep( *.chars >= 9 );
my %words_eq_9 = @words_ge_9 .grep( *.chars == 9 ).Set;
my %words_eq_9 = @words_ge_9 .grep( *.chars == 9 ).Set;


Line 1,335: Line 1,335:
}
}


.say for unique @new_words;</lang>
.say for unique @new_words;</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,369: Line 1,369:


It also allows the minimum length to be specified on the command line (CL) as well as the dictionary file identifier.
It also allows the minimum length to be specified on the command line (CL) as well as the dictionary file identifier.
<lang rexx>/*REXX pgm finds words that're composed from neighbor words (within an identified dict).*/
<syntaxhighlight lang="rexx">/*REXX pgm finds words that're composed from neighbor words (within an identified dict).*/
parse arg minL iFID . /*obtain optional arguments from the CL*/
parse arg minL iFID . /*obtain optional arguments from the CL*/
if minL=='' | minL=="," then minL= 9 /*Not specified? Then use the default.*/
if minL=='' | minL=="," then minL= 9 /*Not specified? Then use the default.*/
Line 1,396: Line 1,396:
end /*j*/
end /*j*/
/*stick a fork in it, we're all done. */
/*stick a fork in it, we're all done. */
say copies('─', 30) finds ' neighbor words found with a minimum length of ' minL</lang>
say copies('─', 30) finds ' neighbor words found with a minimum length of ' minL</syntaxhighlight>
{{out|output|text=&nbsp; when using the default inputs:}}
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
<pre>
Line 1,430: Line 1,430:


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<syntaxhighlight lang="ring">
cStr = read("unixdict.txt")
cStr = read("unixdict.txt")
wordList = str2list(cStr)
wordList = str2list(cStr)
Line 1,474: Line 1,474:


see "done..." + nl
see "done..." + nl
</syntaxhighlight>
</lang>
Output:
Output:
<pre>
<pre>
Line 1,508: Line 1,508:
=={{header|VBScript}}==
=={{header|VBScript}}==
Run it in CScript.
Run it in CScript.
<syntaxhighlight lang="vb">
<lang vb>
with createobject("ADODB.Stream")
with createobject("ADODB.Stream")
.charset ="UTF-8"
.charset ="UTF-8"
Line 1,541: Line 1,541:
next
next


</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,572: Line 1,572:
=={{header|Vlang}}==
=={{header|Vlang}}==
{{trans|AutoHotkey}}
{{trans|AutoHotkey}}
<lang vlang>import os
<syntaxhighlight lang="vlang">import os


fn main() {
fn main() {
Line 1,601: Line 1,601:
}
}
return res_arr
return res_arr
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 1,614: Line 1,614:
{{libheader|Wren-sort}}
{{libheader|Wren-sort}}
{{libheader|Wren-fmt}}
{{libheader|Wren-fmt}}
<lang ecmascript>import "io" for File
<syntaxhighlight lang="ecmascript">import "io" for File
import "/sort" for Find
import "/sort" for Find
import "/fmt" for Fmt
import "/fmt" for Fmt
Line 1,630: Line 1,630:
alreadyFound.add(word)
alreadyFound.add(word)
}
}
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 1,661: Line 1,661:


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>string 0; \use zero-terminated strings
<syntaxhighlight lang="xpl0">string 0; \use zero-terminated strings
int Dict(26000); \pointers to words (enough for unixdict.txt)
int Dict(26000); \pointers to words (enough for unixdict.txt)
int DictSize; \actual number of pointers in Dict
int DictSize; \actual number of pointers in Dict
Line 1,725: Line 1,725:
until DI >= DictSize-9;
until DI >= DictSize-9;
CrLf(0);
CrLf(0);
]</lang>
]</syntaxhighlight>


{{out}}
{{out}}
Line 1,736: Line 1,736:
=={{header|Yabasic}}==
=={{header|Yabasic}}==
{{trans|FreeBASIC}}
{{trans|FreeBASIC}}
<lang yabasic>
<syntaxhighlight lang="yabasic">
open "unixdict.txt" for reading as #1
open "unixdict.txt" for reading as #1
p = 0
p = 0
Line 1,785: Line 1,785:
next n
next n
end
end
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>