Glen Rubin <[email protected]> writes:
> How do I take an element from one collection and test for no remainder
> (e.g. (zero? (mod x y)), when dividing by every element of the second
> collection, before processing the next item in the first collection?
This form checks if every element of the second range is a factor of
every element in the first range:
,----
| (let [r2 (range 100 150)]
| (every?
| #(every? (partial (comp zero? mod) %) r2)
| (range 1000 2000)))
`----
Note that the walk over (range 1000 2000) is the outer one, and the walk
over (range 100 150) ("r2") is the inner one.
--
Steven E. Harris
--
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