Hacker News new | ask | show | jobs
by iroddis 101 days ago
For people that use Lisp extensively, do you find the chording requirements of parentheses (shift-9 or shift-0) annoying? It feels like very bad ergonomics, considering how frequently the characters are used.

Do you use a keyboard with mappings to make it easier? Rely on the editor to insert them for you?

6 comments

It's pretty much the same number of bracket-type characters as other languages, and both () and {} require the use of the shift key. Only counting the parentheses and curly braces:

  (defun hello (name)
    (format t "Hello, ~A!" name)) ;; 6 parens, 6 shift keys

  def hello(name):
    print(f"Hello, {name}") # 4 parens, 2 curlies, 6 shift keys

  void hello(char* name) {
    printf("Hello, %s\n", name);
  } // 4 parens, 2 curlies, 6 shift keys
No real difference for typing.
It is bad ergonomics only on modern keyboards. Back in the day, there were keyboards with "lower case parentheses"[1].

Same case for vi - the : key was in a different place, and no Shift necessary[2].

Nowadays, I use a bespoke layout (in software) that solves the above two problems, among others. My number row is inverted, so parentheses become lower case, and I put the colon key next to 0 and Enter next to P.

[1]: http://xahlee.info/kbd/lisp_keyboards.html

[2]: https://en.wikipedia.org/wiki/ADM-3A#Hardware

A civilized language deserves a civilized layout[1]:

     [{ 1| 2= 3~ 4+  5<  6>  7^ 8& 9% 0* ]} /\
        bB yY oO uU  '(  ")  dD nN gG vV qQ #$ @`
        hH iI aA eE  ,;  .:  tT rR sS cC zZ 
        kK jJ xX wW  -_  ?!  mM lL fF pP
[1]: https://github.com/binarybottle/engram
See also:

  Parinfer: Simpler Lisp Editing (shaunlebron.github.io)
  168 points by harperlee on Jan 20, 2025 | hide | past | favorite | 32 comments
https://news.ycombinator.com/item?id=42766205
probably not worse ergonomic because i type '(' with left pinky and right ring finger and ')' with left pinky and right pinky whereas {} [] etc, i have to use the very same overworked right pinky to distinguish two keys next to each other.

i always have problems with keys that have no obvious dedicated finger position like the middle vertical columns especially 6 and b and of course keys reachable on the right pinky, especially \ and =

I mean, double quotes and curly brackets also require using the Shift key, as do the at sign, number sign, dollar sign, and ampersand. The brackets are a small enough part of the code that it doesn't matter.

And besides:

  print("Hello World");
requires just as much chording as:

  (print "Hello World")
Mostly these days it just requires that you start to type "print" and then press tab when appropriate, though. I feel like I relatively rarely type brackets manually for function calls. Lisp syntax doesn't seem amenable to this particular affordance?
Why not? Could just type 'print', TAB, and have it put brackets and spaces in the right positions and leave the cursor in place for the first argument.
That’s true, but the travel distance of the braces or the double quotes from the home row is much less than the travel distance from the parentheses. Just using shift isn’t the problem, it’s how far parens are from the normal hand position.
> That’s true, but the travel distance of the braces or the double quotes from the home row is much less than the travel distance from the parentheses.

That... depends on your keyboard maybe? On Dvorak the curly brackets are harder to reach than the round brackets. The open round bracket is also hit with the ring finger instead of the little finger, which is weaker.

My ring finger is always slightly sore due to typing ( so often. Not just in LISP but any programming language. I've been experimenting with mapping l; to () when the caps lock key is pressed. So far so good, but I haven't used it long enough to develop muscle memory.