Hi,
I've been dabbling with Clojure for a bit and I am really loving it!!!

I am trying to write a clojure program to download a bunch of URLs and I 
was wondering what is the right way to do it - 
My current implementation is as follows

(def url-sequence (map #(str "http://www.mysite.com/list.php?pageID="; %) 
(range)))

(def download
  (loop [urls url-sequence lst []]
    (let
        [
         u (first urls)
         r (rest urls)
         resp (client/get u)
         next (re-find #"(s?)title=\"next page\">Next >>" (:body 
resp))
         segments ((html2data (:body resp)) :segment)
         data (map segment2data segments)
         ]
      (if next 
        (recur r (conj lst data))
        (conj lst data)))))

I was wondering if I could replace the loop thingy with a map - that is 
when I experimented with a simple piece of code and found something that 
was not intuitive.
I'd really appreciate it if someone could tell me what's going on when I do 
the following -

user> (defn xx [] (map println [1 2 3 4 5 6]))
#'user/xx
user> (take 2 (xx))
(1
2
3
4
5
6
nil nil)
user> 

Regards,
Kashyap

-- 
-- 
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