merits of Lisp vs Python
Ken Tilton
kentilton at gmail.com
Fri Dec 8 14:48:50 EST 2006
Bjoern Schliessmann wrote:
> Alex Mizrahi wrote:
>
>>(message (Hello 'Bjoern)
>
>
>>> BS> Can you give an example? I cannot imagine how homogenity
>>> always BS> results in easiness.
>
>
>
>>homogenity means that i can cut any expression and paste in any
>>other expression, and as long as lexical variables are ok, i'll
>>get correct results -- i don't have to reindent it or whatever.
>
>
> Ah, so *that's* what you meant ... but I don't really understand the
> ease of it.
Code in the abstract exists as a tree of trees. With parens, we now have
textual markers delimiting these trees. That means I can point to any
arbitrary subtree by pointing to its left or right parens, and tell the
editor to copy or delete "that chunk of logic". And now I am
manipulating chunks of program logic instead of text.
One simple but hopefully illustrative example: suppose I have an if
statement with two big branches. My code then looks like:
(if (condition) (big-branch-1)(big-branch-2))
Please remember that any of those fakes can be arbitrarily deep nested
expressions. Now during refactoring, I decide bb-2 processing goes
elsewhere, maybe somewhere "upstream" in the logic. So I double-click
and then drag-and-drop, or cut and paste.
Then I double-click on the entire if statement, and then do a
control-click on the "then" condition, control-click happening to mean
"paste what I am clicking". Suddenly the "then" is the whole form.
(And, yes, this means my vendor took away from me the normal
copy-and-drop associated with control click <g>, but I could modify
things to get it back if I really cared.)
Of course the next question has to be, how often does that come up? When
refactoring it sometimes feels like I do nothing else. :) It turns out
that this is an insanely natural way to work with code.
Note also that after any amount of dicing I simply hit a magic key combo
and the editor reindents everything. In a sense, Lisp is the language
that handles indentation best.
hth, ken
--
Algebra: http://www.tilton-technology.com/LispNycAlgebra1.htm
"Well, I've wrestled with reality for thirty-five
years, Doctor, and I'm happy to state I finally
won out over it." -- Elwood P. Dowd
"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
More information about the Python-list
mailing list