<p>Hey Gophers! I'm a Javascript developer by trade who decided to give Go a spin. As a learning exercise I decided to port a function in one of my node projects, but can't get it working for the life of me. The function's purpose is to display all of the valid english words that can be made from the letters present in a different word (I'm building a multiplayer version of <a href="http://zone.msn.com/gameplayer/gameplayer.aspx?game=texttwist" rel="nofollow">Text Twist</a>). For example, findAllWords("dances") would return ['can','scan','dance','dances',etc...]. I've achieved this by recursing on a trie built from an English word list. </p>
<p><a href="https://gist.github.com/wmain/7f39611f1b82c179e92a4a9c04808f91" rel="nofollow">Here is the function's implementation in Javascript</a> and <a href="https://gist.github.com/wmain/99ae79d2d4e64e56a24757b20676f62e" rel="nofollow">here's my attempt at replicating it in Go</a> (using <a href="https://github.com/derekparker/trie" rel="nofollow">this</a> trie implementation).</p>
<p>Would love to know why this is failing, how I can get it working, and any conventions I'm abusing/not making use of. Thanks!</p>
<hr/>**评论:**<br/><br/>alpabet: <pre><p>in your go file, I think line 8 should just be 'continue', a return would stop the function and not continue the loop where your js implementation goes to the next iteration.</p></pre>bonekeeper: <pre><p>Out of curiosity, can you upload the full wordlist you are using somewhere? I need an English wordlist for a project.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传