Last active
April 6, 2016 10:51
-
-
Save divs1210/5f344be5c877adc6f2b775f7fc914f31 to your computer and use it in GitHub Desktop.
This works fine for some time, but then I start getting an exception saying: "No implementation of method: :search of protocol: #'some.thing/ISearchEngine found for class: some.thing.SearchEngine"
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
(defprotocol ISearchEngine | |
"Search the web" | |
(search [engine term] "Search the web for a single (one-word) term.")) | |
(defrecord SearchEngine [url] | |
ISearchEngine | |
(search [this term] | |
(-> (str (:url this) term) | |
http/get deref :body))) | |
(defonce google | |
(SearchEngine. "https://www.google.co.in/search?q=")) | |
(defonce bing | |
(SearchEngine. "https://www.bing.com/search?q=")) | |
(defonce ddg | |
(SearchEngine. "https://duckduckgo.com/?q=")) | |
(search google "wonko+the+sane") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment