Created
April 11, 2016 01:07
-
-
Save yang-wei/f4b38bff97f9fcad659c3fa7491ad73f to your computer and use it in GitHub Desktop.
Clojure fetch url
This file contains 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
(defn fetch-url[address] | |
(with-open [stream (.openStream (java.net.URL. address))] | |
(let [buf (java.io.BufferedReader. | |
(java.io.InputStreamReader. stream))] | |
(apply str (line-seq buf))))) | |
(fetch-url "http://google.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment