Details
-
Type:
Defect
-
Status:
Closed
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
The profile function from clojure.contrib.profile can run into
an Exception when it's argument is a lazy sequence.
Reproduce this problem:
(use 'clojure.contrib.profile) (defn foo [x] (prof :foo (+ x 10))) (profile (map foo (range 5))) ==> java.lang.IllegalArgumentException: Wrong number of args passed to: core$max (profile (pmap foo (range 5))) ==> java.lang.IllegalArgumentException: Wrong number of args passed to: core$max (profile (doseq [i (range 5)] (foo i))) ==> Works fine
stu said: The problem isn't lazy sequences, but the absence of any data to report on. Commit 6dd033d9e12337f6630faa3d3f5c2e901a28c4f4 prevents the exception, and causes the printed report to be empty in the case there is nothing to report.
On the calling side, the examples shown above aren't profiling anything, because the lazy calls are never evaluated. You should use some kind of "do" form instead.