Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Scala version #7

Merged
merged 24 commits into from Apr 16, 2015
Merged

Adds Scala version #7

merged 24 commits into from Apr 16, 2015

Conversation

colindean
Copy link
Contributor

This Scala version seems to work. It's at least passing tests!

One potential problem is that the Trie node itself doesn't know where it is. It just knows its value, which is None if it's not a leaf node, or Some("word") if it's a leaf. This has the advantage of storing words only in leaf nodes, but at the expense of something I'm not sure I understand well enough to miss.

I intend to generify this so that any data structure that supports head and tail can be inserted into the trie.

This needs some cleanup!
I'm aiming for valid JSON. I want to indent it properly, too..
…efix

Protects add() because it's only to be used internally.
The import of reflectiveCalls in TrieTest is necessary to silence
a warning about access theTrie in the fixture.
I cannot think of a better name for this method right now.
I cannot believe I didn't notice this before now.
I really think most of these javadocs could go away.
@vivekn
Copy link
Owner

vivekn commented Apr 16, 2015

Thanks, Colin.

vivekn added a commit that referenced this pull request Apr 16, 2015
@vivekn vivekn merged commit 8a27a93 into vivekn:master Apr 16, 2015
@vivekn
Copy link
Owner

vivekn commented Apr 16, 2015

I don't think storing the string at every node, or for that matter even at the leaf node is necessary, we can always traverse the path to find the string, so that is fine. I had changed the Python code a few months ago to reflect this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants