This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import division | |
| import string | |
| import math | |
| tokenize = lambda doc: doc.lower().split(" ") | |
| document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy." | |
| document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption." | |
| document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people." | |
| document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (<|>) :: Parser a -> Parser a -> Parser a | |
| parser1 <|> parser2 = P $ \some -> case parse parser1 some of | |
| [] -> parse parser2 some | |
| result -> result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| instance Options MainOptions where | |
| defineOptions = | |
| MainOptions <$> defineOption optionType_bool a_help | |
| <*> defineOption optionType_bool a_version | |
| <*> defineOption optionType_string a_path | |
| where a_help opt = opt { optionLongFlags = ["help"] | |
| , optionShortFlags = ['h'] | |
| } | |
| a_version opt = opt { optionLongFlags = ["version"] | |
| , optionShortFlags = ['v'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun my-send-to-nrepl () | |
| (interactive) | |
| (let ((p (point))) | |
| (cider-eval-last-sexp 't) | |
| (goto-char p) | |
| (insert " ;;=> "))) | |
| (defun my-send-to-nrepl2 () | |
| (interactive) | |
| (let ((p (point))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $stack, $draws = [], {} | |
| def method_missing *args | |
| return if args[0][/^to_/] | |
| $stack << args.map { |a| a or $stack.pop } | |
| $draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
| end | |
| class Array | |
| def +@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
NewerOlder