Sometimes you have to manually stamp out laziness, for this among other reasons.
In some cases I apply the list function to do this:

=> (str (map inc (range 10)))
"clojure.lang.LazySeq@c5d38b66"

=> (str (apply list (map inc (range 10))))
"(1 2 3 4 5 6 7 8 9 10)"

 -Lee


> On 8 July 2014 09:49, Glen Rubin <rubing...@gmail.com> wrote:
> my-fn takes a number and a string as argument and outputs a string.  I am 
> using map-indexed and my-fn to comprehend a list of items with numbered index 
> as follows, 
>  
>  
> (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap))
>  
> When i run this on the repl everything works well and I get a single long 
> string of output. But, I am trying to use the output of this function in a 
> report and it is not working in that context.
>  
> The code to generate report looks something like this:
>  
>  (str
>       string1
>       string2
>       string3
>     (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap))
>       string4....etc...
> )
>  
> The code above will just print out 'clojure-lazy-seq' instead of the string 
> output.  If I try:
>  
> (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)))
>  
> Then I get the last item from my list properly formated in the report, but 
> that's all.  How do I print out everything?  Thanks
> 

-- 
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/d/optout.

Reply via email to