you could do something like: (map str ["hello1" "hello2" "hello3"] (repeat "world"))
there is also a time macro: (time (println "oh hi")) On Fri, Oct 22, 2010 at 5:48 AM, Marc von Bihl <mvonb...@googlemail.com> wrote: > Hello, I am new to fucntional programming and have 2 questions: > > How can I apply a function to each element from a list and a second > parameter? > > (def lstr '("Hello1" "Hello2" "Hello3")) > > (defn addtoString [s1 s2] > (str s1 s2)) > > (apply (addtoString lstr "World")) > > --------- > > I need it for the following example (pseudo code). > How would you realize this in Clojure?: > > function testit [times, function, list, s] > for (0 to times) > def start = System.nanoTime() > def results = [] > for (i = 0 to list.length()) > results.add(function(listelement(i), s)) > def end = System.nanoTime() > println "run took " end-start " ns" > println "results are: " > results.each { result => println result } > > > > -- > 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 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