Page 1 of 3

Question about parentheses

Posted: Mon Apr 19, 2010 8:07 am
by Jonsul
I've just started learning lisp(bought all the little schemer books to get me going) I love the language alot, it really opens your mind about the possibilities and abstract thinking of computers. There's was just a question that's been on my mind for a while since starting. Why all the parentheses?
I mean I know what they're for but why no brackets? It seems like a symbol that would be used that much shouldn't be a two key combo. Seems like a road to carpel tunnel lol. Would it be simple to just modify a compiler of interpreter to read brackets instead of parentheses?
Else is there a faster way to type parentheses, like a way to turn off numbers for a sec or something.

Re: Question about parentheses

Posted: Mon Apr 19, 2010 8:42 am
by ramarren
Well, if you look at the Space Cadet keyboards, which were used in many Lisp Machines, parentheses were where the square brackets are on most current keyboards.

Modifying the keyboard layout is fairly easy, at least on Linux. And it is even easier to redefine keys in Emacs, which is the best editor for Lisp editing. There is a Cliki page with some hints.

Brackets/Parentheses on Windows

Posted: Mon Apr 19, 2010 10:31 pm
by Kohath
Hey. I use Windows almost all of the time, and I was being driven mad too. I use AutoHotkey :D, and in my .ahk file, I have this:

Code: Select all

[::
Suspend On
SendInput (){left}
Suspend Off
Return

]::
Suspend On
SendInput )
Suspend Off
Return

(::
Suspend On
SendInput []{left}
Suspend Off
Return

)::
Suspend On
SendInput ]
Suspend Off
Return

+[::
Suspend On
SendInput +[+]{left}
Suspend Off
Return
The above code swaps brackets and parentheses, and always enters the corresponding closing character along with the opening one for each type (and repositions the caret between them). I've got a bit of other general stuff in the file to, if you're interested. Even lispier :twisted:, I have replaced capslock with dash:

Code: Select all

CapsLock::-
I originally had this:

Code: Select all

CapsLock::Backspace
Backspace::CapsLock
but I found that I use '-' more (and there are other reasons).

Re: Question about parentheses

Posted: Mon Apr 19, 2010 10:44 pm
by Paul Donnelly
Use paredit.el or something like it and you'll type half the parentheses.

Re: Question about parentheses

Posted: Tue Apr 20, 2010 9:44 am
by Jasper
In Emacs you can (also)Switch the [] characters with ().

Re: Brackets/Parentheses on Windows

Posted: Fri Apr 23, 2010 8:46 pm
by Paul
Kohath wrote:Hey. I use Windows almost all of the time, and I was being driven mad too.
Driven mad? If you're using Windows, you must already be mad, no?

Re: Brackets/Parentheses on Windows

Posted: Sat Apr 24, 2010 6:39 am
by TheGZeus
Paul wrote:
Kohath wrote:Hey. I use Windows almost all of the time, and I was being driven mad too.
Driven mad? If you're using Windows, you must already be mad, no?
Oh, snap!

Re: Question about parentheses

Posted: Thu Apr 29, 2010 5:53 pm
by lithos
I think a lisp forum is the last place you should be bashing someone for which tools they use :lol:
______
Parenthesis are there en-masse so that it's computer readable. As for being human readable they eventually fade away and you'll just read them similarly to how your read indentation in other languages.

Re: Question about parentheses

Posted: Thu Apr 29, 2010 7:47 pm
by Paul
lithos wrote:I think a lisp forum is the last place you should be bashing someone for which tools they use :lol:
Why? I could see saying that about a <choose-any-non-Lisp-language> forum...

Re: Question about parentheses

Posted: Fri Aug 13, 2010 4:34 pm
by findinglisp
Paul Donnelly wrote:Use paredit.el or something like it and you'll type half the parentheses.
+1. Paredit rocks.