This is Julia version of 100 numpy exercises
Latest version of 100 numpy excercises are available at this repository.
You can see executed results here
| str = <<`EOS` | |
| printenv | |
| EOS | |
| #=> "RBENV_VERSION=2.0.0-p353\n... |
| [121] pry(main)> case str | |
| [121] pry(main)* when ->(t){ t.size == 4 } | |
| [121] pry(main)* puts 'size eq 4' | |
| [121] pry(main)* else | |
| [121] pry(main)* puts 'not eq 4' | |
| [121] pry(main)* end | |
| size eq 4 | |
| => nil |
| count = 0 | |
| if target_user_ids.empty? | |
| count += Foo.all.count | |
| else | |
| target_user_ids.each do |user_ids| | |
| count += Foo.where(user_id: user_ids).count | |
| end | |
| end |
This is Julia version of 100 numpy exercises
Latest version of 100 numpy excercises are available at this repository.
You can see executed results here
| diff --git a/src/lib/kytea.cpp b/src/lib/kytea.cpp | |
| index 8dbae30..04324c3 100644 | |
| --- a/src/lib/kytea.cpp | |
| +++ b/src/lib/kytea.cpp | |
| @@ -74,6 +74,11 @@ void Kytea::addTag(typename Dictionary<Entry>::WordMap& allWords, const KyteaStr | |
| Entry::setInDict(it->second->inDict,dict); | |
| } | |
| } | |
| + | |
| + |
| dict = Dict() | |
| @time for i in [1:10000000] | |
| dict[i] = 1 | |
| end | |
| # elapsed time: 22.824151615 seconds (2413509808 bytes allocated, 9.20% gc time) | |
| dict = Dict() | |
| @time for i in [1:10000] | |
| dict[i] = 1 | |
| end |
| # Julia using -O wakati | |
| using Benchmark | |
| using MeCab | |
| function count_word(text::UTF8String) | |
| mecab = Mecab("-O wakati") | |
| counts = Dict{UTF8String, Int}() | |
| for word in split(sparse_tostr(mecab, text)) | |
| counts[word] = get(counts, word, 0) + 1 | |
| end |
| julia> Pkg.update() | |
| INFO: Updating METADATA... | |
| ...snip... | |
| INFO: Building Homebrew | |
| remote: Counting objects: 818, done. | |
| remote: Compressing objects: 100% (232/232), done. | |
| remote: Total 818 (delta 644), reused 759 (delta 585) | |
| Receiving objects: 100% (818/818), 92.06 KiB | 0 bytes/s, done. | |
| Resolving deltas: 100% (644/644), completed with 144 local objects. | |
| From https://github.com/Homebrew/homebrew |