From: Dave Yost
Subject: Advice for Parenthophobes
Date:
Message-ID: <3kn8cd$qj@Yost.com>
In article <··········@cantaloupe.srv.cs.cmu.edu>,
Scott Fahlman <···@CS.CMU.EDU> wrote:
>
>In article <··········@stc06.CTD.ORNL.GOV> ···@jt3ws1.seas.ucla.edu (Kennel) writes:
> After all, Euler had a choice.
>
>Euler didn't have a text editor that would pretty-print stuff as he
>typed it in and show him which parens match which. Without that, Lisp
>notation can sometimes be painful. Now there's no excuse...
Attention parenthophobes:
This is one of the keys to the Parenthetical Mystery. You
have to experience a lisp-smart editor yourself for perhaps
several hours to understand how an interactive lisp-editing
tool affects your perception of lisp syntax. A major part
of Parenthophobia is worrying about all those piled-up
parentheses on the right at the end. The modern text
editors for lisp make this a non-problem. But you have to
experience it yourself to get it.
Another key to the Parenthetical Mystery is to realize that
any symbology that is new to you will be unfamiliar compared
to what you already know, and raw unfamiliarity is the first
barrier you have to cross before you understand something
new. I know from my own personal experience that lisp code
might as well have been Chinese for all the visual sense it
made to me. Even when I started working with it, it took
some time before it started to _look_ sensible. Here again,
an interactive lisp-smart editor actually helps readability
because you can verify for yourself how the grouping works
by using the editor to show you matching parentheses or by
using it to correct the indentation as you modify the code.
Another key is the fact that lispers tend to use 2-character
indentation, when you, a non-parenthetical person, are
probably more uncomfortable with less than 4 or even 8
character indentation. This takes getting used to as well,
though you can set the editor to your favorite amount of
indent if you don't want to try to get used to 2.
These are the main keys to unlocking the Parenthetical Mystery.
I believe that until you have spent some time investigating
the Mystery through your own experience, using a lisp-smart
editor, your expressions of distaste are merely statements
of these barriers to entry, not statements of the
inferiority of parenthesized syntax.
I know. I was a C person for over a decade before finally
deciding, despite my Parenthophobia, that it would be an
important growth path for me to learn Common Lisp. I now
prefer lisp's parenthesized syntax, although I can still easily
work with C-like syntax, since it is my Mother tongue, as it
were. I do dread ever having to do significant work again in
C/C++ for many other reasons, though.
Dave Yost
In article <·········@Yost.com>, ····@Yost.com (Dave Yost) writes:
> Another key to the Parenthetical Mystery is to realize that
> any symbology that is new to you will be unfamiliar compared
> to what you already know, and raw unfamiliarity is the first
I was doing some C(++) hacking last night, and while modifying
several lines of the form
new_right = pval[2];
to
new_right = coeff * pval[2];
by cut&paste, I had this ultra feeling of strangeness, something
seemed wrong, and I started looking at the code, and it took me about
a second or two to realize that my mind was craving to see
(* coeff pval[2])
I've been doing lisp whenever I could since many years now,
but it's the first time I've spent more than two years doing
just that (except for a couple of small C hacks). So maybe
that what it takes, not to be a good or advanced lisper, but
a member of a `lisp race' (nothing to do with wizardry or even
understanding lisp, just seeing parenthesized notation as
THE natural one (not just `natural'), regardless of the bias
inscribed in our brains (even lispers) because of using infix
notation for arithmetic since learning 1 + 1 when you were
0 to 6 years old..
PS: I had to resort to this C(++) hacking for a demo
because of FFI hassles, of course.
And lisp would be so much better for demo.. GRRR!
--
F.D. Mato Mira http://ligwww.epfl.ch/matomira.html
Computer Graphics Lab ········@epfl.ch
EPFL FAX: +41 (21) 693-5328
Dave Yost (····@Yost.com) wrote:
> This is one of the keys to the Parenthetical Mystery. You
> have to experience a lisp-smart editor yourself for perhaps
> several hours to understand how an interactive lisp-editing
> tool affects your perception of lisp syntax. A major part
> of Parenthophobia is worrying about all those piled-up
> parentheses on the right at the end. The modern text
> editors for lisp make this a non-problem. But you have to
> experience it yourself to get it.
Yes and no. A Lisp-smart editor changes an insane parentheses
counting problem into a somewhat less difficult but still non-trivial
visual positional matching problem which, in my personal
preference, is unfortunately more difficult than doing the same
with automatically indented irregular keyword languages given
similarly complex programs.
> Dave Yost
Matt
In article <··········@stc06.ctd.ornl.gov>, ······@msr.epm.ornl.gov wrote:
>Yes and no. A Lisp-smart editor changes an insane parentheses
>counting problem into a somewhat less difficult but still non-trivial
>visual positional matching problem which, in my personal
>preference, is unfortunately more difficult than doing the same
>with automatically indented irregular keyword languages given
>similarly complex programs.
I don't find the "visual positional matching problem" to be difficult, and
it certainly is easier than matching {}s in c code written by a variety of
programmers with the parens in a variety of places.
The main thing I miss from my days as a lisp hacker was c-m-T in emacs.
[ Actually I only posted this to test my news server which wasn't allowing
posting just a few minutes ago, but I thought this was better than junk on
*.test. ]
Chris
--
Chris Garrigues ···@DeepEddy.Com
609 Deep Eddy Avenue +1 512 499 0483
Austin, TX 78703-4513 USA
My pgp key is on my home page: http://www.DeepEddy.Com/~cwg/
···@jt3ws1.etd.ornl.gov (Kennel) writes:
>A Lisp-smart editor changes an insane parentheses
>counting problem into a somewhat less difficult but still non-trivial
>visual positional matching problem which, in my personal
>preference, is unfortunately more difficult than doing the same
>with automatically indented irregular keyword languages given
>similarly complex programs.
Well, it depends on what you mean by a "Lisp-smart" editor.
The editors I used on Xerox 11xxs were TEdit, DEdit, and SEdit.
All of them had the convention that the entire current selection was
underlined. TEdit was for text. DEdit was the "old" display editor
for Lisp, and Sedit was the "new" structure editor that worked nicely
with Xerox Common Lisp. The "visual positional matching problem"
was "look at the underline". This was in no sense hard. It was,
in fact, "a total no-brainer". Other Xerox editors were similar.
(Am I the only one who still quadruple-clicks to select a paragraph
and wonders why it doesn't work?)
GNU Emacs, and my own Emacs-like editor, handle parenthesis balancing
thus: when you type a right bracket, the cursor goes to the matching
left bracket and flashes there for a bit, then goes back where it "belongs".
Again, the mental effort required for matching is minimal; all you need is
coarse "change detection", which is well within the capacity of a frog.
Then again, you can do backward-sexp,forward-sexp by hand to get a "feel"
for where the edges are.
I note that GNU Emacs underlines a selection while I'm doing it by
dragging the mouse; is there any reason why GNU Emacs couldn't have an
"underline current S-exp" command/mode?
--
"The complex-type shall be a simple-type." ISO 10206:1991 (Extended Pascal)
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
In article <··········@goanna.cs.rmit.edu.au> Richard A. O'Keefe writes:
> I note that GNU Emacs underlines a selection while I'm doing it by
> dragging the mouse; is there any reason why GNU Emacs couldn't have an
> "underline current S-exp" command/mode?
If your GNU Emacs is Lucid or XEmacs, it already does. Try this:
(setq highlight-paren-expression t)
(load-library "blink-paren")
GNU Emacs, at least at 19.28 vintage, doesn't seem to support this yet.
>>>>> "Russell" == Russell Ritchie <·······@gssec.bt.co.uk> writes:
Russell> In article <··········@goanna.cs.rmit.edu.au> Richard A. O'Keefe writes:
>> I note that GNU Emacs underlines a selection while I'm doing it by
>> dragging the mouse; is there any reason why GNU Emacs couldn't have an
>> "underline current S-exp" command/mode?
Russell> If your GNU Emacs is Lucid or XEmacs, it already does. Try this:
Russell> (setq highlight-paren-expression t)
Russell> (load-library "blink-paren")
Russell> GNU Emacs, at least at 19.28 vintage, doesn't seem to support this yet.
It does. The library is only called "paren". So doeing a
(load-library "paren")
will turn on highlighting of matching parenthesis, though it
apparently does not support highlighting of entire sexp's. However,
that is supplied by the package "stig-paren", that was posted to
gnu.emacs.sources some time ago.
------------------------------------------------------------------------------
Christian Lynbech | Hit the philistines three times over the
office: R0.33 (phone: 3217) | head with the Elisp reference manual.
email: ·······@daimi.aau.dk | - ·······@hal.com (Michael A. Petonic)
------------------------------------------------------------------------------
In article <··········@stc06.ctd.ornl.gov>, ······@msr.epm.ornl.gov wrote:
> Dave Yost (····@Yost.com) wrote:
>
> > This is one of the keys to the Parenthetical Mystery. You
> > have to experience a lisp-smart editor yourself for perhaps
> > several hours to understand how an interactive lisp-editing
> > tool affects your perception of lisp syntax. [stuff deleted]
>
> Yes and no. A Lisp-smart editor changes an insane parentheses
> counting problem into a somewhat less difficult but still non-trivial
> visual positional matching problem which, in my personal
> preference, is unfortunately more difficult than doing the same
> with automatically indented irregular keyword languages given
> similarly complex programs.
There's usually no visual matching involved at all. Position the cursor
to a parentheses, and either its match blinks or the editor gives you a
way to jump the cursor to the matching paren.
Lisp-smart editors usually indent as you type, and will even automatically
reindent your code upon demand.
Dave
---
CPU Cycles: Use them now or lose them forever...
http://www.teleport.com/~dlamkins
In article <··········@stc06.ctd.ornl.gov>,
Kennel <······@msr.epm.ornl.gov> wrote:
>Dave Yost (····@Yost.com) wrote:
>
>> This is one of the keys to the Parenthetical Mystery. You
>> have to experience a lisp-smart editor yourself for perhaps
>> several hours to understand how an interactive lisp-editing
>> tool affects your perception of lisp syntax. A major part
>> of Parenthophobia is worrying about all those piled-up
>> parentheses on the right at the end. The modern text
>> editors for lisp make this a non-problem. But you have to
>> experience it yourself to get it.
>
>Yes and no. A Lisp-smart editor changes an insane parentheses
>counting problem into a somewhat less difficult but still non-trivial
>visual positional matching problem which, in my personal
>preference, is unfortunately more difficult than doing the same
>with automatically indented irregular keyword languages given
>similarly complex programs.
With an in-core structure editor, such for example as the wonderful
DEdit, it is literally impossible to get your brackets either out of
sync or out of proper pretty-print alignment.
Next problem?
--
------- ·····@rheged.dircon.co.uk (Simon Brooke)
"This young man has not the faintest idea how socialists think and does
not begin to understand the mentality of the party he has been elected
to lead. He is quite simply a liberal" -- Ken Coates MEP (Lab) of Tony Blair
Kennel (···@jt3ws1.etd.ornl.gov) wrote:
: Dave Yost (····@Yost.com) wrote:
: > This is one of the keys to the Parenthetical Mystery. You
: > have to experience a lisp-smart editor yourself for perhaps
: > several hours to understand how an interactive lisp-editing
: > tool affects your perception of lisp syntax. A major part
: > of Parenthophobia is worrying about all those piled-up
: > parentheses on the right at the end. The modern text
: > editors for lisp make this a non-problem. But you have to
: > experience it yourself to get it.
: Yes and no. A Lisp-smart editor changes an insane parentheses
: counting problem into a somewhat less difficult but still non-trivial
: visual positional matching problem which, in my personal
: preference, is unfortunately more difficult than doing the same
: with automatically indented irregular keyword languages given
: similarly complex programs.
: > Dave Yost
: Matt
When I'm reading well-written lisp code, I hardly notice the parens,
any more than I see semi-colons when I read C code. If I have to pay
attention to syntax at that level, it often means something
pathological is occurring, independently of the language.
I use a language called REFINE that uses an infix syntax on top of
Common Lisp augmented by many features. Shifting between Lisp and
Refine code requires almost no pauses and reads about equally fast--
I'm seeing essentially the same thing (except in cases where the
Refine code uses additional features such as transforms), much as your
mind's eye sees a story unfold when you nominally are reading the
words in a novel.
Going from Refine to C code, however, requires a complete mental
shift, since it's the semantics, not the syntax, that affects my
reading speed.