Ok, I understand what it does but I don't understand -yet- how it is works. Why vector and its parameters aren't in ( ) ? What are the parameters to the vector and what are the parameters to the map in the example?
On Aug 28, 6:12 pm, nickikt <nick...@gmail.com> wrote: > (iterate inc 1) is not the function vector is > > what you do is call vector with the first of primes and (iterate inc > 1) > > so the first things map does is > (vector 1 2) => [1 2] > (vector 2 3) => [2 3] > (vector 2 5) => [3 5] > > meaning the first is the index number the second is the corresponding > prime number > > (take 5 ordinals-and-primes) would therefore look like this > ([1 2] [2 3] [3 5] [4 7] [5 11]) > > On 28 Aug., 16:57, HB <hubaghd...@gmail.com> wrote: > > > > > Hey, > > I came across this method: > > > (use '[clojure.contrib.lazy-seqs :only (primes)]) > > (def ordinals-and-primes (map vector (iterate inc 1) primes)) > > > map macro has this format: > > (map function collection) > > primes is the collection and (iterate inc 1) is the function to apply > > on each element of the collection but how vector is applied here? > > > But I don't understand the previous method, would you please explain > > it to me. > > 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