-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I keep getting the exception, "clojure.lang.ArityException: Wrong number of args (0) passed to: core//"
I've isolated it to the second recur line. Is this a bug? Thanks.
(ns group-a-sequence)
(defn my-group-by [f s]
(loop [x (rest s)
acc {(f (first s)) [(first s)]}]
(if (not (empty? x))
(if (not (nil? (get acc (f (first x)))))
(recur (rest x) (assoc acc (f (first x)) (conj (get acc (f (first x))) (first x))))
;*********************
(recur (rest x) acc)) ; clojure.lang.ArityException: Wrong number of args (0) passed to: core//
;*********************
;(recur (rest x) (assoc acc (f (first x)) [(first x)])))
;acc)))
3)))
(def s [[1 2] [2 4] [4 6] [3 6]])
(def f #(apply / %))
(my-group-by f s)
Metadata
Metadata
Assignees
Labels
No labels