Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report #2

Open
johnasbaghi opened this issue Apr 9, 2016 · 0 comments
Open

Bug report #2

johnasbaghi opened this issue Apr 9, 2016 · 0 comments
Assignees

Comments

@johnasbaghi
Copy link

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)

@erochest erochest self-assigned this Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants