Hi everyone,

I'm new to Clojure, and after a lot of reading I wrote a couple of 
functions.
They are working and doing what they are supposed to, but I was wondering 
if the way I wrote the functions was optimal and if I made any conceptual 
errors which advanced programmers avoid.
Basically: Are they what they call the "clojure" way?

(defn download-source [url]
  (let [stream (java.io.BufferedReader. (java.io.InputStreamReader. (.. 
(java.net.URL. url) openStream)))]
    (loop [b (.readLine stream), acc ""]
      (if (= b nil) acc
        (recur (.readLine stream) (str acc b))))))

(println (download-source "http://google.com";))

This function for example downloads the source of a webpage and returns it 
as a string.
Could this have been written in a better way?
I want to get a feeling of what is considered good practice/design in 
clojure.

Nice Regards

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to