Re: map closure issue

2009-05-31 Thread Ben
Thank you. doseq is probably more what I was looking for. I was thinking mapcar when I used map, but I really don't want the resulting seq anyway. I'll be a lot more careful about lazy evaluation, I'm just not used to it. Again thanks for your response. On May 30, 8:55 pm, Timothy Pratley

map closure issue

2009-05-30 Thread Ben
I'm not sure if this is an issue or not. I broke it down to a simple case. When I pass a Java object into a map closure the object doesn't seem to get updated: (let [b (new StringBuffer)] (map #(.. b (append (str % ))) '(blah blah blah)) b) ;= #StringBuffer expected ;= #StringBuffer blah

Re: map closure issue

2009-05-30 Thread Timothy Pratley
Lazy evaluation strikes again! map doesn't actually do anything until you force it eg with dorun. This is quite a common mistake! Does anyone know how one would go able making a warning be printed when a lazy seq is created and thrown away without any evaluation? I'd be interested in implementing

Re: map closure issue

2009-05-30 Thread Timothy Pratley
Further to explain this behaviour: (let [b (new StringBuffer)]   (map #(.. b (append (str % ))) '(blah blah blah))) #StringBuffer blah blah blah ) If you are using the REPL the return result is the lazy-seq, and this gets forced to display the result. However in your original code you