You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: cookbook/rand-replace, compiling:(/Users/john/code/github/data-analysis-with-clojure/src/data_analysis/cookbook.clj:94:1)
The text was updated successfully, but these errors were encountered:
You code doesn't compile:
(defn rand-replace
[m k v](assoc %28dissoc m %28rand-nth %28keys m%29%29%29 k v))
(defn range-from [x](map %28partial + x%29 %28range%29))
(defn sample-exactly [k coll](->> coll
%28drop k%29
%28map vector %28range-from %28inc k%29%29%29
%28filter #%28<= %28rand%29 %28/ k %28first %%29%29%29%29
%28reduce rand-replace
%28into {} %28map vector %28range k%29 %28take k coll%29%29%29%29
%28sort-by first%29
%28map second%29))
(sample-exactly 10 (range 1000))
CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: cookbook/rand-replace, compiling:(/Users/john/code/github/data-analysis-with-clojure/src/data_analysis/cookbook.clj:94:1)
The text was updated successfully, but these errors were encountered: