On Mon, Oct 26, 2009 at 6:09 PM, kyle smith the1physic...@gmail.com wrote:
Rather than the number of nodes in a tree, I think a better metric
would be the number of edges in a graph. Variables that are
referenced on many different lines should get double counted. I think
this would explain
On Mon, Oct 26, 2009 at 12:45 AM, Timothy Pratley
timothyprat...@gmail.comwrote:
This sounds like a neat idea to me. Maybe the way to get the
'complexity' is to calculate it at definition, this macro doesn't work
for obvious reasons:
(defmacro defnc
[n body]
`(let [f# (defn ~n
On Mon, Oct 26, 2009 at 1:09 AM, Chouser chou...@gmail.com wrote:
(count-nodes abcde)
; 6
Yikes.
Maybe special-casing strings would be best: change (seqable? x) into (and
(seqable? x) (not (string? x))). I don't know if Seqable is synonymous with
that; might there be other seqable?s
Hi,
On Oct 26, 7:08 am, John Harrop jharrop...@gmail.com wrote:
(count-nodes abcde)
; 6
Yikes.
Maybe special-casing strings would be best: change (seqable? x) into (and
(seqable? x) (not (string? x))). I don't know if Seqable is synonymous with
that; might there be other
On Oct 25, 11:56 pm, MarkSwanson mark.swanson...@gmail.com wrote:
I'd like to run
count-nodes against a compiled fn that I've previously defined, but I
could not get an existing fn into quoted form
Can't be done. Once a fn is compiled, it's just Java bytecode.
-SS
Rather than the number of nodes in a tree, I think a better metric
would be the number of edges in a graph. Variables that are
referenced on many different lines should get double counted. I think
this would explain why imperative spaghetti code is so complex. On
the other hand, I suspect
On Mon, Oct 26, 2009 at 6:20 AM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
Can't be done. Once a fn is compiled, it's just Java bytecode.
On the other hand, size of the generated byte code is moderately
interesting (as is runtime performance in time and heap).
I do *love* the fact that
Reading http://www.paulgraham.com/power.html and specifically the section
titled Metrics near the top, I realized that it would be very easy to
calculate such metrics for Lisp code, and it took me literally only seconds
to hack something in Clojure:
user= (defn count-nodes [data] (if
That's interesting.
I ran this against a quoted Clojure fn of mine and received 92.
I'm curious (general Clojure question) about your use of the quoted
form. The Clojure docs state that this results in an unevaluated form,
but I had trouble finding more details on this. F.E. I'd like to run
On Sun, Oct 25, 2009 at 10:08 PM, John Harrop jharrop...@gmail.com wrote:
4 public class NodeCounter {
8 public static int countNodes (Object data) {
10 if (!(data instanceof Iterable)) return 1;
5 int result = 1;
8 for (Object e : (Iterable)data) {
6
On Sun, Oct 25, 2009 at 11:56 PM, MarkSwanson mark.swanson...@gmail.comwrote:
I'm curious (general Clojure question) about your use of the quoted
form. The Clojure docs state that this results in an unevaluated form,
but I had trouble finding more details on this. F.E. I'd like to run
This sounds like a neat idea to me. Maybe the way to get the
'complexity' is to calculate it at definition, this macro doesn't work
for obvious reasons:
(defmacro defnc
[n body]
`(let [f# (defn ~n ~...@body)]
(alter-meta! (var ~n) assoc :complexity (count-nodes ~body))
f#))
But I
On Sun, Oct 25, 2009 at 10:08 PM, John Harrop jharrop...@gmail.com wrote:
Reading http://www.paulgraham.com/power.html and specifically the section
titled Metrics near the top, I realized that it would be very easy to
calculate such metrics for Lisp code, and it took me literally only seconds
13 matches
Mail list logo