Compile-time Trie in Crystal
-
Add the dependency to your
shard.yml
:dependencies: crie: github: c910335/crie
-
Run
shards install
require "crie"
# Build Trie at compile time
Crie << "En aru'din Raszagal"
Crie << ["Khassar de templari", "Zhakul inok"]
Crie.add_suffixes_of("Terrie Khala")
# Search at compile time
Crie.search("En Taro Adun") # => 3
Crie.search("Khala dora") # => 5
Crie.search("Nas beru uhn'adarr") # => 0
# Search at run time
crie = Crie.new
crie.search("Zhara ku'nuul") # => 3
crie.search("Khas ara'shar") # => 4
crie.search("Shozak mok nul") # => 0
- Fork it (https://github.com/c910335/crie/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Tatsiujin Chin - creator and maintainer