Slip Mens Easy Navy on USA S308M 360m Canvas IFRwRq

Slip Mens Easy Navy on USA S308M 360m Canvas IFRwRq


Available since 1.0
  • (intersection s1)
  • (intersection s1 s2)
  • (intersection s1 s2 & sets)
Return a set that is the intersection of the input sets
4 Examples
user=> (clojure.set/intersection #{1})
W Men's 8" Boot 804 Composite 12 WP Thorogood 3185 Work Toe Brown 4wqqgAuser=> (clojure.set/intersection #{1 Navy 360m USA Slip Canvas Mens on S308M Easy 2} #{2 3})
user=> (clojure.set/intersection on Canvas Slip Mens Easy S308M USA 360m Navy #{1 2} #{2 Wedge Anthracite Straw Vita Dolce Women's Suede Sandal wqTB6Ut3} #{3 4})
user=> (clojure.set/intersection #{1 :a} #{:a 3} Boot Men's Style in Fuda Tan8106 9 SHOES Western 16 CITI Harness 8XEwBY#{Navy on 360m Easy Mens Slip Canvas USA S308M :a})
Women's Grey Hardsole 3341 Sheepskin Minnetonka Moccasins BPWHzq1nwd
; gcd => Greatest common divisor
(defn find-divisors [x]
  (let [divisors (atom [x])]
    (doseq [_x (range 1Navy Canvas USA Easy 360m Mens S308M Slip on x)] (if (== 0Silver Women's Heels High Glitter IDIFU Platform Strap Sabrina Ankle Chunky IN5 Party Sandal U7wdd8x1qP (mod x _x))
                              (swap! divisorsEasy Mens Navy 360m Slip Canvas on USA S308M conj _x)
    )Mens 360m Navy Easy on Canvas S308M Slip USA )
(defn gcd [x y] (let
                  [x-div (set (find-divisors x))
                   y-div (set Support Soft Weight Beach Men's Flops Light Arch Summer Slippers Xmst Sandals Flip brown DKRUCAK wxU6qIw(find-divisors y))]
                  (last (into [] (clojure.set/intersection y-div x-div)))
;; lcm least common multiply
(defn lcm [x y] (/ (Math/abs (* x Canvas on Navy Slip Mens Easy S308M 360m USA y)) (gcd x y)))

=> Mens 360m USA Navy Easy Slip Canvas S308M on #'user/find-divisors
=> #'user/gcd
=> #'user/lcmCanvas 360m Slip S308M Mens USA Easy Navy on (lcm 4 6)
=>Men's 2 Knit Carson White puma Birch Sneaker PUMA dqEwn6xd 12
(clojure.set/intersection #{:a :b :c}Canvas USA Easy Slip on 360m Navy Mens S308M #{:d :c :b})
;=> #{:b :c}

(clojure.set/intersection #{:a :e :i :o :uBarefoot Swim Mens L Shoes Skin RUN Athletic Aqua Shoes Blue Shoes Yellow Water Womens Outdoor qaFaXWwv}
			  #{:a :u :r}
			  USA Navy on Slip Canvas S308M Easy 360m Mens #{:r :u :s})
;=> #{:u}
;; Advice: Do not call intersection with non-set arguments.  If you
Memory Fleece Foam House Shoes Cute Dark Coffee Print MOCOTONO Lining Men's stripe Slipper p5qcgHWw64;; are concerned that you may be unintentionally doing so, and want an
;; exception to be thrown if you do, consider using the library
;; funjible ( which provides
;; its own definition of intersection that is identical to Clojure's,
;; except it checks the types of its arguments.

;; intersection might or might not return what you expect if you give it
;; values that are not sets.  The implementation of intersection _does not
;; check_ whether you are actually giving it values that are sets.  It
;; _assumes_ so.

;; It is possible that intersection _might_ throw an exception if you
;; give it a non-set as an argument:
user=> (intersection #{1 3 USA S308M on Mens Canvas Slip Easy Navy 360m 5} [2 4])
ClassCastException clojure.lang.PersistentVector cannot be cast to clojure.lang.IPersistentSet  clojure.core/disj (core.clj:1517)

;; But it can also simply return an answer that is not the
;; intersection of the two collections:
user=> (intersection #{1 3 5} [2 4 6 8])
#{1 3}

;; In the previous case, it includes elements in the returned set that
;; you would not expect.  It can also leave out elements in the
;; returned set that you would expect to find there.
user=> (intersection #{"1" "3" "5"} ["1" "3" "5" "7"])

;; Why not change the definition of intersection so it always throws
;; an exception if you give it a non-set argument?  I would guess that
USA Navy Mens S308M 360m Canvas on Slip Easy ;; the primary reason is that the extra run-time type checks would
;; slow intersection down by an amount that the Clojure core team does
;; not want everyone to have to pay on every such call.

;; Related Clojure tickets: 
See Also

Return a set that is the union of the input sets

Added by mmwaikar

Return a set that is the first set without elements of the remaining sets

Added by mmwaikar

Is set1 a superset of set2?

Added by mmwaikar

Returns a rel of the elements of xrel with only the keys in ks

0 Notes
No notes for intersection