clojure.contrib.trace/deftrace does not work with function definitions with doc-strings
Apparently, defttrace does not support functions with doc-strings. I tried replacing defn with deftrace in a function of mine (as the docs indicated) and I got the following error -
Sample code to reproduce the error -
Would be great if this bug is fixed, all my functions have doc-strings :)
java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol
Sample code to reproduce the error -
(deftrace fact
"Calculate the factorial of x"
[x]
(if (< x 1)
1
(* x (fact (- x 1)))))
Would be great if this bug is fixed, all my functions have doc-strings :)
Leave a comment
This patch adds support and tests for both docstrings and metadata, and also fixes the regex in the existing test to correctly identify errors. The current regex has unescaped characters: | ( ) that were almost certainly typos, as matching (for instance) only the last line of output would pass the test. The docstring/metadata support is a simplified version of what's in the source of defn.