On Mon, Oct 26, 2009 at 6:09 PM, kyle smith 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 why imperative spagh
On Mon, Oct 26, 2009 at 6:20 AM, Stuart Sierra
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 the analysis can be done i
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 func
On Oct 25, 11:56 pm, MarkSwanson 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
--~--~-~--~~~---~--~-
Hi,
On Oct 26, 7:08 am, John Harrop 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 that
On Mon, Oct 26, 2009 at 1:09 AM, Chouser 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 that aren't Seq
On Mon, Oct 26, 2009 at 12:45 AM, Timothy Pratley
wrote:
>
> 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-m
On Sun, Oct 25, 2009 at 10:08 PM, John Harrop 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
> to hack someth
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 t
On Sun, Oct 25, 2009 at 11:56 PM, MarkSwanson wrote:
> 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
> count-nodes against a compile
On Sun, Oct 25, 2009 at 10:08 PM, John Harrop 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 result +
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
count
12 matches
Mail list logo