http://bost.ocks.org/mike/treemap/Wow, yeah, that's a really interesting idea. Is there just one (good) way to map a codebase? Many?
It seems like a bad idea at first glance, since the map shows, at any level, more things with less context-per-thing when compared to straight text. It seems totally natural to use it for profiling. Refactoring would be a lot more grokable if it could all be visualized at once. But how would it work for scanning/editing & digging through documentation?
In practice, everyone just uses emacs to indent, no problem.
http://bl.ocks.org/mbostock/4063582
I'm not really a lisp coder at all (a bit of clojure experience), but the relentless self-similarity of lisp languages is both a strength and a weakness, IMHO. But it's regular syntax would make it a good candidate for a treemap. Just sayin'.
4clojure.com is a good resource to see how experienced clojure programmers can turn what would 50 lines of imperative code into a handful of keywords. The self-similarity is a non-issue. Saying it is a negative is like saying Mozart used "too many notes" in his music.
In other words, you don't have a clue. Right, thanks for clearing that up.
Because Lisp communities tend to eschew an imperative programming style, sequential operations tend to be composed of nested functions (and therefore indented) in lieu of passing values by mutable variables to blocks of sequential instructions.
Though arguments about programming styles are always going to remain unconvincing because the benefits of one over the other or vice versa are revealed when programmers are actually writing programs, it is objectively the case, that Lisp's indentation idiom can be used to express the sequence of execution for programs written using a functional style in a consistent way.
The lets might look like so (warning- silly example):
(defn n-squared-over-two-plus-three-as-str [n]
(let [squared (* n n)
halved (/ squared 2.0)
added (+ halved 3)]
(str added)))
> (n-squared-over-two-plus-three-as-str 1)
"3.5"
Sure, I could've just done this as a deeply-nested structure: > ((fn [n] (str (+ 3 (#(/ % 2.0) (* n n))))) 1)
"3.5"
... but it's harder to read, debug, and reason about. You wouldn't do that in a non-functional language either! I suppose the tolerance for deep nesting is different for different programmers.[1] https://github.com/dpritchett/cloball/blob/62300d31666ab1261...
(defn example [n]
(let [square #(* % %)
halve #(/ % 2.0)
add3 #(+ % 3)]
(-> n square halve add3 str)))
> (example 1)
"3.5" (defn square-halve-add3-to-string [n]
(-> n
(#(* % %))
(/ 2.0)
(+ 3)
str))