Question about parentheses

Whatever is on your mind, whether Lisp related or not.
Jonsul
Posts: 18
Joined: Mon Apr 19, 2010 7:56 am

Question about parentheses

Post by Jonsul » Mon Apr 19, 2010 8:07 am

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.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Question about parentheses

Post by ramarren » Mon Apr 19, 2010 8:42 am

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.

Kohath
Posts: 61
Joined: Mon Jul 07, 2008 8:06 pm
Location: Toowoomba, Queensland, Australia
Contact:

Brackets/Parentheses on Windows

Post by Kohath » Mon Apr 19, 2010 10:31 pm

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).

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Question about parentheses

Post by Paul Donnelly » Mon Apr 19, 2010 10:44 pm

Use paredit.el or something like it and you'll type half the parentheses.

Jasper
Posts: 209
Joined: Fri Oct 10, 2008 8:22 am
Location: Eindhoven, The Netherlands
Contact:

Re: Question about parentheses

Post by Jasper » Tue Apr 20, 2010 9:44 am

In Emacs you can (also)Switch the [] characters with ().

Paul
Posts: 106
Joined: Tue Jun 02, 2009 6:00 am

Re: Brackets/Parentheses on Windows

Post by Paul » Fri Apr 23, 2010 8:46 pm

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?

TheGZeus
Posts: 79
Joined: Mon Jun 30, 2008 10:46 am

Re: Brackets/Parentheses on Windows

Post by TheGZeus » Sat Apr 24, 2010 6:39 am

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!

lithos
Posts: 14
Joined: Tue Feb 02, 2010 4:11 pm

Re: Question about parentheses

Post by lithos » Thu Apr 29, 2010 5:53 pm

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.

Paul
Posts: 106
Joined: Tue Jun 02, 2009 6:00 am

Re: Question about parentheses

Post by Paul » Thu Apr 29, 2010 7:47 pm

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...

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: Question about parentheses

Post by findinglisp » Fri Aug 13, 2010 4:34 pm

Paul Donnelly wrote:Use paredit.el or something like it and you'll type half the parentheses.
+1. Paredit rocks.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

Post Reply