> (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)
The map function takes a function and any number of collections:
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/map
> 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?
In the code you cited, the function is "vector" and the collections are the
remaining arguments.
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/vector
> But I don't understand the previous method, would you please explain it to me.
The function produces a lazy sequence of vectors of two items, the first an
ordinal and the second a prime.
--Steve
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en