Hi everyone
Just had an idea this morning - don't know how good it is tho since
I'm very new to Lisp. Would like to get some feedback:-
So for the context:
I don't know about you, but I think Python's use of whitespace makes
code very pleasing to look at. I'm guessing this is partially why
it's gotten so popular.
Now the idea I'm proposing: I was thinking about this in regards to
Lisp, and I thought, why can't it be represented like that as well?
Example:
test 2
blah 2 3
asdf 3 4 (test 156)
setq blah 3
bleh 15
...
can be translated to sexprs based on whitespace:
(test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
>From a parsing perspective:
* For every new line, prefix with a ( to create a sexpr.
* If next line has the same level indent, close off sexpr with a ).
* If next line is indented, don't do anything.
* If next line is outdented, add a ), and for each level it is
outdented, add a ).
Interesting Points
* You can still use parentheses, but they've to be on the same line.
* I'm not sure about things like quoting & backquoting sexprs, macros,
etc. But I imagine all potential problems are solvable, if there are
any.
What does everyone think?
Khookie wrote:
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
Get it from yourself when you are only mildly new to Lisp.
hth,kzo
On Wed, 18 Jul 2007, Khookie wrote:
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
>
> So for the context:
>
> I don't know about you, but I think Python's use of whitespace makes
Sorry to spoil your enthusiasm, but it has been done many times before.
Try to search for lisp whitespace syntax parenthesis or something like
that.
>
> What does everyone think?
>
It may be convenient for people learning lisp who are familiar with more
algol-like syntax. I would guess about 99.9992342% of lispers don't use it
though.
Khookie wrote:
> I don't know about you, but I think Python's use of whitespace makes
> code very pleasing to look at. I'm guessing this is partially why
> it's gotten so popular.
F# adds whitespace-sensitive syntax to OCaml. This has the advantage that
the bodies of declarations and top-level definitions have uniform syntax.
In OCaml you would write:
let x = 3
...
but inside another function
let f() =
let x = 3 in
...
So the F# approach makes it slightly easier to evaluate lines interactively
and removes some clutter from the code.
However, this comes at the (IMHO grave) cost of rendering automatic
indenting impossible. In OCaml, you just hit ALT-Q in emacs and the current
block of code is automatically indented. In F#, you must indent all code
manually and the slightest mistake can put bugs in your code. This was the
most tedious part of translating a 50kLOC OCaml code base into F# for me.
> Now the idea I'm proposing: I was thinking about this in regards to
> Lisp, and I thought, why can't it be represented like that as well?
A lot of people advocate syntactic changes to Lisp. Some implement them.
None get widely adopted by the Lisp community.
The only way you'll get widespread acceptance for an idea like this is if
you also create a new language that is better than Lisp in some respects.
Perhaps the best way to attack this problem is to create a tool that can
translate between the two and maybe even put it into an IDE. That way we
can edit Lisp code using a decent syntax and the existing Lispers can edit
the same code cluttered with superfluous parentheses.
--
Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
Khookie <··········@gmail.com> writes:
> test 2
> blah 2 3
> asdf 3 4 (test 156)
> setq blah 3
> bleh 15
> ...
>
> can be translated to sexprs based on whitespace:
>
> (test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
> [...]
> What does everyone think?
You should implement it! Really.
--
__Pascal Bourguignon__ http://www.informatimago.com/
THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.
Khookie wrote:
> can be translated to sexprs based on whitespace:
^^^^^^^^^^^^^^^^^^^
Not everyone's cup of tea to do things that way.
One of the reasons I don't use that other language.
Can anybody make a statistic how often this topic comes up in this
usegroup! (and correlates to user = newbie)
Khookie wrote:
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
>
> So for the context:
>
> I don't know about you, but I think Python's use of whitespace makes
> code very pleasing to look at. I'm guessing this is partially why
> it's gotten so popular.
>
> Now the idea I'm proposing: I was thinking about this in regards to
> Lisp, and I thought, why can't it be represented like that as well?
>
> Example:
>
> test 2
> blah 2 3
> asdf 3 4 (test 156)
> setq blah 3
> bleh 15
> ...
>
> can be translated to sexprs based on whitespace:
>
> (test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
>
>>From a parsing perspective:
> * For every new line, prefix with a ( to create a sexpr.
> * If next line has the same level indent, close off sexpr with a ).
> * If next line is indented, don't do anything.
> * If next line is outdented, add a ), and for each level it is
> outdented, add a ).
>
> Interesting Points
> * You can still use parentheses, but they've to be on the same line.
> * I'm not sure about things like quoting & backquoting sexprs, macros,
> etc. But I imagine all potential problems are solvable, if there are
> any.
>
> What does everyone think?
>
Michael Bohn <············@gmx.de> writes:
> Can anybody make a statistic how often this topic comes up in this
> usegroup! (and correlates to user = newbie)
I wonder why Lisp is prone to this kind of suggestions. C, Fortran
Java and their ilk don't elicit the "Whoa! New language! Let's
change its syntax!" reaction.
Tamas
>>>>> "TP" == Tamas Papp <······@gmail.com> writes:
TP> I wonder why Lisp is prone to this kind of suggestions. C,
TP> Fortran Java and their ilk don't elicit the "Whoa! New
TP> language! Let's change its syntax!" reaction.
Because the people who want to change Lisp are coming at it as a
second language, and it is very different from other things they've
seen before. When they learned their first language, they had nothing
to compare the syntax to, and then if they later learned one of C,
C++, Java, Perl, Python, Ruby, Pascal, Visual Basic, C#.NET, all of
these have similar syntax. Lisp has very different syntax, and it
takes a lot of experience in Lisp before you see that the syntax is an
advantage and not just a matter of preference.
Charlton
--
Charlton Wilbur
·······@chromatico.net
Charlton Wilbur wrote:
>>>>>> "TP" == Tamas Papp <······@gmail.com> writes:
...
> Lisp has very different syntax, and it
> takes a lot of experience in Lisp before you see that the syntax is an
> advantage and not just a matter of preference.
>
> Charlton
>
>
Thats true, they teaching us Lisp on our university (thats how I've come
to this great language) and approximately 95%
of the students learn Lisp for the exams and afterwards forget about it
as soon as possible. You have to get over the hill of parenthesis to see
the full beauty of Lisp :)
Michael Bohn wrote:
> Thats true, they teaching us Lisp on our university...
I really hope they teach you some good languages as well...
--
Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
Doctpr Jon wrote:
> Michael Bohn wrote:
>
>>Thats true, they teaching us Lisp on our university...
>
>
> I really hope they teach you some good languages as well...
>
Not yours, according to a recent Road where it struck out:
" What led you to try Lisp?
I was looking at writing a domain specific language for complex pattern
matching. I wrote a first version in OCaml, but I found the type system
to be intrusive. Types were things that evolved when I worked and OCaml
-- even with a REPL and decent Emacs mode -- didn't encourage such a
process. In short, it didn't flow. I knew of Lisp macros and decided to
see what I could do with them. Turns out they flow quite nicely."
Whoa, an intrusive type system? Whoda thunk it?
Ken Tilton wrote:
> Whoa, an intrusive type system? Whoda thunk it?
Anyone who finds correctness intrusive.
--
Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
Jon Harrop wrote:
> Ken Tilton wrote:
>
>>Whoa, an intrusive type system? Whoda thunk it?
>
>
> Anyone who finds correctness intrusive.
>
Dude, you lack flow, game over. Ah, hang on, your personality is all
about conflict, obstruction, pain, and suffering, of course flow means
nothing to you.
Meanwhile, I thought the straw supporting Ocaml's back was performance.
Now you are clutching at correctness? That was snatched away by TDD
about five years ago. Try to keep up, will you, Doctor? You were fun for
a while but have not really been much of a match lately.
kzo
Jon Harrop wrote:
>> Thats true, they teaching us Lisp on our university...
> I really hope they teach you some good languages as well...
From my experience and what I hear from others, it's all Java these
days. At least in (a good part of) the German university system, Lisp,
where it existed at all, has been so thoroughly wiped out like the name
of pharao Akhenaten by his immediate successors, probably for much of
the same reasons.
You'd probably prefer this situation, due to java's "better syntax" not
spoiling the poor students...
Jon Harrop escreveu:
> Michael Bohn wrote:
>> Thats true, they teaching us Lisp on our university...
>
> I really hope they teach you some good languages as well...
>
I think you are being obtrusively rude in this NG. . .
On Jul 19, 10:37 pm, Michael Bohn <············@gmx.de> wrote:
> Charlton Wilbur wrote:
> >>>>>> "TP" == Tamas Papp <······@gmail.com> writes:
>
> ...
>
> > Lisp has very different syntax, and it
> > takes a lot of experience in Lisp before you see that the syntax is an
> > advantage and not just a matter of preference.
>
> > Charlton
>
> Thats true, they teaching us Lisp on our university (thats how I've come
> to this great language) and approximately 95%
> of the students learn Lisp for the exams and afterwards forget about it
> as soon as possible. You have to get over the hill of parenthesis to see
> the full beauty of Lisp :)
Great, in our university they *lean* lisp with pen and paper togather
with prolog and clips, starting with AI from day one. No wonder
everybody love to be relieved of the stupid lisp when they see the
brand new Visual Studio powered by C# or Eclipse java combination.
Slobodan Blazeski wrote:
> On Jul 19, 10:37 pm, Michael Bohn <············@gmx.de> wrote:
>> Charlton Wilbur wrote:
>>>>>>>> "TP" == Tamas Papp <······@gmail.com> writes:
>> ...
>>
>>> Lisp has very different syntax, and it
>>> takes a lot of experience in Lisp before you see that the syntax is an
>>> advantage and not just a matter of preference.
>>> Charlton
>> Thats true, they teaching us Lisp on our university (thats how I've come
>> to this great language) and approximately 95%
>> of the students learn Lisp for the exams and afterwards forget about it
>> as soon as possible. You have to get over the hill of parenthesis to see
>> the full beauty of Lisp :)
>
> Great, in our university they *lean* lisp with pen and paper togather
> with prolog and clips, starting with AI from day one. No wonder
> everybody love to be relieved of the stupid lisp when they see the
> brand new Visual Studio powered by C# or Eclipse java combination.
>
>
Maybe this can help a little :)
http://sourceforge.net/projects/dandelion-ecl
On Jul 20, 2:29 pm, Michael Bohn <············@gmx.de> wrote:
> Slobodan Blazeski wrote:
> > On Jul 19, 10:37 pm, Michael Bohn <············@gmx.de> wrote:
> >> Charlton Wilbur wrote:
> >>>>>>>> "TP" == Tamas Papp <······@gmail.com> writes:
> >> ...
>
> >>> Lisp has very different syntax, and it
> >>> takes a lot of experience in Lisp before you see that the syntax is an
> >>> advantage and not just a matter of preference.
> >>> Charlton
> >> Thats true, they teaching us Lisp on our university (thats how I've come
> >> to this great language) and approximately 95%
> >> of the students learn Lisp for the exams and afterwards forget about it
> >> as soon as possible. You have to get over the hill of parenthesis to see
> >> the full beauty of Lisp :)
>
> > Great, in our university they *lean* lisp with pen and paper togather
> > with prolog and clips, starting with AI from day one. No wonder
> > everybody love to be relieved of the stupid lisp when they see the
> > brand new Visual Studio powered by C# or Eclipse java combination.
>
> Maybe this can help a little :)http://sourceforge.net/projects/dandelion-ecl- Hide quoted text -
>
> - Show quoted text -
I doubt, everybody I have a chance to talk with is so duscusted from
seeing parens that trying to explain the benefits of lisp is just
futile. And yes I tried rewriting their Java assignements in 5 line
lisp under 3 minutes , but that didn't help so I just stopped trying .
If they like java/c#/php they could have it.
Tamas Papp wrote:
> Michael Bohn <············@gmx.de> writes:
>
>> Can anybody make a statistic how often this topic comes up in this
>> usegroup! (and correlates to user = newbie)
>
> I wonder why Lisp is prone to this kind of suggestions. C, Fortran
> Java and their ilk don't elicit the "Whoa! New language! Let's
> change its syntax!" reaction.
I don't think that's the case. When I switched from Modula-2/Oberon to
Java during the 90's, I also would have preferred a Wirth-style syntax
over a C-style syntax. I would also claim that changes in syntax are the
major driving force for all the new languages that pop up every few
years - it can't be the semantics because they are rarely very interesting.
What is different in Lisp is that you get this idea that you can
actually change things yourself. My guess is that people have the
feeling that they can finally have the "dream syntax" they always craved
for. This is actually not so far from the truth.
In essence, I think it's a positive attitude, it's only misdirected at a
very superficial aspect of the language. It takes a while to learn that
the semantic modifications that you can add to a Lisp dialect are much
more interesting. Plus it matters that you need the experience with the
malleable Lisp syntax to appreciate the fact that it's not "more"
user-friendly in a shallow sense, and you simply don't have these
insights from day one.
That's why I also don't like the tendency to label people with such
suggestions as trolls. Essentially, the positive attitude is there, it
just needs better guidance.
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
Pascal Costanza wrote:
> ... Plus it matters that you need the experience with the
> malleable Lisp syntax to appreciate the fact that it's not "more"
> user-friendly in a shallow sense, and you simply don't have these
> insights from day one.
There is certainly an on-going assumption here that macros require
homogeneous syntax.
--
Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
Jon Harrop wrote:
> Pascal Costanza wrote:
>> ... Plus it matters that you need the experience with the
>> malleable Lisp syntax to appreciate the fact that it's not "more"
>> user-friendly in a shallow sense, and you simply don't have these
>> insights from day one.
>
> There is certainly an on-going assumption here that macros require
> homogeneous syntax.
No.
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
>>>>> "JH" == Jon Harrop <···@ffconsultancy.com> writes:
JH> There is certainly an on-going assumption here that macros
JH> require homogeneous syntax.
You may be assuming that, but I see no evidence that anyone else does.
Charlton
--
Charlton Wilbur
·······@chromatico.net
Charlton Wilbur wrote:
>>>>>> "JH" == Jon Harrop <···@ffconsultancy.com> writes:
>
> JH> There is certainly an on-going assumption here that macros
> JH> require homogeneous syntax.
>
> You may be assuming that...
On the contrary, OCaml and Mathematica have shown it to be wrong.
--
Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
Jon Harrop escreveu:
> Pascal Costanza wrote:
>> ... Plus it matters that you need the experience with the
>> malleable Lisp syntax to appreciate the fact that it's not "more"
>> user-friendly in a shallow sense, and you simply don't have these
>> insights from day one.
>
> There is certainly an on-going assumption here that macros require
> homogeneous syntax.
>
I don't think it may be so desirable, after of all.
Pascal Costanza <··@p-cos.net> writes:
> Tamas Papp wrote:
>> Michael Bohn <············@gmx.de> writes:
>>
>>> Can anybody make a statistic how often this topic comes up in this
>>> usegroup! (and correlates to user = newbie)
>>
>> I wonder why Lisp is prone to this kind of suggestions. C, Fortran
>> Java and their ilk don't elicit the "Whoa! New language! Let's
>> change its syntax!" reaction.
>
> I don't think that's the case. When I switched from Modula-2/Oberon to
> Java during the 90's, I also would have preferred a Wirth-style syntax
> over a C-style syntax. I would also claim that changes in syntax are
> the major driving force for all the new languages that pop up every
> few years - it can't be the semantics because they are rarely very
> interesting.
When I switched to C, I started to
#define IF if(
#define THEN ){
#define ELSE }else{
#define END } while(0) /* for the ; */
...
This allowed to "port" quickly some Modula-2 code :-)
> What is different in Lisp is that you get this idea that you can
> actually change things yourself. My guess is that people have the
> feeling that they can finally have the "dream syntax" they always
> craved for. This is actually not so far from the truth.
>
> In essence, I think it's a positive attitude, it's only misdirected at
> a very superficial aspect of the language. It takes a while to learn
> that the semantic modifications that you can add to a Lisp dialect are
> much more interesting. Plus it matters that you need the experience
> with the malleable Lisp syntax to appreciate the fact that it's not
> "more" user-friendly in a shallow sense, and you simply don't have
> these insights from day one.
>
> That's why I also don't like the tendency to label people with such
> suggestions as trolls. Essentially, the positive attitude is there, it
> just needs better guidance.
Of course, they're just newbies and they should be encouraged into
hacking this new syntax they want. Once they'll have programmed it,
they'll know more lisp programming and most probably will forget about
their personal syntax right away.
--
__Pascal Bourguignon__ http://www.informatimago.com/
In a World without Walls and Fences,
who needs Windows and Gates?
(message (Hello 'Tamas)
(you :wrote :on '(Thu, 19 Jul 2007 15:52:31 +0200))
(
??>> Can anybody make a statistic how often this topic comes up in this
??>> usegroup! (and correlates to user = newbie)
TP> I wonder why Lisp is prone to this kind of suggestions. C, Fortran
TP> Java and their ilk don't elicit the "Whoa! New language! Let's
TP> change its syntax!" reaction.
hehe, i remember a story about some major programmer, who liked Pascal
syntax but had to write in C.
so he did
#define begin {
#define end }
and so on, and was programming in this weird mixture -- and people who had
to support his code also had to work with this nightmare.
i think it's not that uncommon for C programmers to alter syntax (in weird
and limited way, though)
)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"scorn")
On Jul 20, 9:17 pm, "Alex Mizrahi" <········@users.sourceforge.net>
wrote:
> (message (Hello 'Tamas)
> (you :wrote :on '(Thu, 19 Jul 2007 15:52:31 +0200))
> (
>
> ??>> Can anybody make a statistic how often this topic comes up in this
> ??>> usegroup! (and correlates to user = newbie)
>
> TP> I wonder why Lisp is prone to this kind of suggestions. C, Fortran
> TP> Java and their ilk don't elicit the "Whoa! New language! Let's
> TP> change its syntax!" reaction.
>
> hehe, i remember a story about some major programmer, who liked Pascal
> syntax but had to write in C.
> so he did
>
> #define begin {
> #define end }
>
> and so on, and was programming in this weird mixture -- and people who had
> to support his code also had to work with this nightmare.
> i think it's not that uncommon for C programmers to alter syntax (in weird
> and limited way, though)
>
> )
> (With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
> "scorn")
The most annoying thing with pascal syntax is that you cant close
begin end like yo can do with { } at VS . Actually I would like that
feature with common lisp ides . It won't help as much as with pascal
because writing enormous functions with lisp is bad style but with
Delphi is quite common to see procedure 3 pages long.
On Fri, 20 Jul 2007 22:17:43 +0300
"Alex Mizrahi" <········@users.sourceforge.net> wrote:
> hehe, i remember a story about some major programmer, who liked Pascal
> syntax but had to write in C.
> so he did
>
> #define begin {
> #define end }
>
> and so on, and was programming in this weird mixture -- and people who had
> to support his code also had to work with this nightmare.
> i think it's not that uncommon for C programmers to alter syntax (in weird
> and limited way, though)
For some reason, almost all early books on C written in Polish, when it came
to preprocessor, included an example header file that would translate those
ugly, horrible, unreadabable English keywords that nobody understands to
Polish:
#define if jezeli
#define else inaczej
#define while dopoki
#define int calkowita
and so on.
Unfortunately, I didn't see any of these in production.
--
__ Maciek Pasternacki <·······@japhy.fnord.org> [ http://japhy.fnord.org/ ]
`| _ |_\ / { ...I have a social life?
,|{-}|}| }\/ --- you will, when she turns you into on of the living dead. }
\/ |____/ ( Megatokyo 442 ) -><-
Tamas Papp escreveu:
> Michael Bohn <············@gmx.de> writes:
>
>> Can anybody make a statistic how often this topic comes up in this
>> usegroup! (and correlates to user = newbie)
>
> I wonder why Lisp is prone to this kind of suggestions. C, Fortran
You have not seen some "{algol.pascal} addicts" who created some include
files to replace the "{" by "begin" and "}" by "end", etc. in C, have you!?
> Java and their ilk don't elicit the "Whoa! New language! Let's
> change its syntax!" reaction.
For Java, the explanation is slightly simpler: people are still
strugling to get it right!
--
Cesar Rabak
On 19 Jul, 00:47, Khookie <··········@gmail.com> wrote:
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
>
> So for the context:
>
> I don't know about you, but I think Python's use of whitespace makes
> code very pleasing to look at. I'm guessing this is partially why
> it's gotten so popular.
>
> Now the idea I'm proposing: I was thinking about this in regards to
> Lisp, and I thought, why can't it be represented like that as well?
>
> Example:
>
> test 2
> blah 2 3
> asdf 3 4 (test 156)
> setq blah 3
> bleh 15
> ...
>
> can be translated to sexprs based on whitespace:
>
> (test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
>
> >From a parsing perspective:
>
> * For every new line, prefix with a ( to create a sexpr.
> * If next line has the same level indent, close off sexpr with a ).
> * If next line is indented, don't do anything.
> * If next line is outdented, add a ), and for each level it is
> outdented, add a ).
>
> Interesting Points
> * You can still use parentheses, but they've to be on the same line.
> * I'm not sure about things like quoting & backquoting sexprs, macros,
> etc. But I imagine all potential problems are solvable, if there are
> any.
>
> What does everyone think?
Wouldn't you have to write {f (a) b) as
f
a ) b
?
If you're new to s-expressions have a look at paredit
http://www.emacswiki.org/cgi-bin/wiki/ParEdit and try switching the ()
and [] keys round on the keyboard when in lisp-mode. They both make
life much nicer.
I also bind a function that calls newline-and-indent and insert-
parentheses to return and just newline-and-indent to M-return, which
gives typing a similar feel to the whitespace based coding you're
suggesting.
You are using emacs, I hope.
On Thu, 19 Jul 2007 22:16:59 +0000, Chris Russell wrote:
> try switching the () and [] keys round on the keyboard when in lisp-mode.
How do you do this locally in the mode, and not globally?
Matt
--
"You do not really understand something unless you
can explain it to your grandmother." - Albert Einstein.
On 20 Jul., 04:55, Matthew Swank
<································@c.net> wrote:
> On Thu, 19 Jul 2007 22:16:59 +0000, Chris Russell wrote:
> > try switching the () and [] keys round on the keyboard when in lisp-mode.
>
> How do you do this locally in the mode, and not globally?
(google-group comp.lang.lisp '(remap keyboard))
On Fri, 20 Jul 2007, Christopher Koppler wrote:
> On 20 Jul., 04:55, Matthew Swank
> <································@c.net> wrote:
>> On Thu, 19 Jul 2007 22:16:59 +0000, Chris Russell wrote:
>>> try switching the () and [] keys round on the keyboard when in lisp-mode.
>>
>> How do you do this locally in the mode, and not globally?
>
>
> (google-group comp.lang.lisp '(remap keyboard))
>
I don't understand why switching () and [] would help. [] is accessed by
stretching the little finger, which is very hard to do without moving
the right hand away from standard position. (), on the other hand, can be
typed without moving the right (or left) hand away from standard position.
Kjetil S. Matheussen wrote:
> I don't understand why switching () and [] would help. [] is accessed
> by stretching the little finger, which is very hard to do without
> moving the right hand away from standard position. (), on the other
> hand, can be typed without moving the right (or left) hand away from
> standard position.
That really depends on the size of your hands ? And the layout of
your keyboard, of course. And possibly what you consider standard
position:
Certainly, with my fingers in the english standard touch typing position
(asdf/jkl;), [/] are not a particular stretch on a british keyboard,
about the same as Q/TAB. I notice wikipedia says that some countries
teach a different position in the first place.
On Fri, 20 Jul 2007, David Golden wrote:
> Kjetil S. Matheussen wrote:
>
>> I don't understand why switching () and [] would help. [] is accessed
>> by stretching the little finger, which is very hard to do without
>> moving the right hand away from standard position. (), on the other
>> hand, can be typed without moving the right (or left) hand away from
>> standard position.
>
> That really depends on the size of your hands ?
I don't think so. I have quite big hands, but I still lift my right hand a
little bit when pressing [ or ]. I don't have to though, I can just
stretch my little finger instead, but that hurts a little bit, so I don't.
For a person with average size hands or smaller, it probably gets even
worse, I imagine.
> And the layout of
> your keyboard, of course.
> And possibly what you consider standard
> position:
>
> Certainly, with my fingers in the english standard touch typing position
> (asdf/jkl;), [/] are not a particular stretch on a british keyboard,
No, its not a particular stretch, but its a stretch which tempts one to
move the hand a little bit. When accessing 8/9, however, you can still
keep the remaining fingers in the j/k/l/; position without feeling pain
because then the fingers are bending up/down and not sideways, which
happens when strething for [].
> about the same as Q/TAB.
Not quite, Q/TAB corresponds to p/[.
> I notice wikipedia says that some countries
> teach a different position in the first place.
>
Yes, my native language keyboard setting has the keys positioned in really
stupid positions which makes it extremely uncomfortable to do programming.
(using the alt key for accessing [, ], { and } for example) So I use
english keyboard setting instead, which is not unusual for programmers to
do.
Kjetil S. Matheussen wrote:
> No, its not a particular stretch, but its a stretch which tempts one
> to move the hand a little bit.
It's okay to move your hands when touch typing, it's bending your wrists
that's a real mistake.
>> about the same as Q/TAB.
>
> Not quite, Q/TAB corresponds to p/[.
>
Due to interrow staggering, p is to the left of ;, just as
q is to the left of a. Thus, [ is a typically bit further away than q,
but closer than tab. You might consider ] in turn a bit further
away than TAB, but if you habitually hit the (typically
enlarged) tab key on-center rather than off-center it doesn't
really feel so.
Interrow staggering and size of tab key may also be variable
from keyboard to keyboard.
On Fri, 20 Jul 2007, David Golden wrote:
> Kjetil S. Matheussen wrote:
>
>> No, its not a particular stretch, but its a stretch which tempts one
>> to move the hand a little bit.
>
> It's okay to move your hands when touch typing, it's bending your wrists
> that's a real mistake.
>
Really? Well, I see that my wrist is a little bit bended when typing 8 or
9, but I don't understand why that is a problem. Its certainly much faster
to type 8 or 9 than [ or ], and it doesn't hurt either. But I guess this
is individual since if you have shorter fingers, the bending will probably
be bigger, and my fingers are relatively long.
Kjetil S. Matheussen wrote:
>
> Really? Well, I see that my wrist is a little bit bended when typing 8
> or 9,
I can't see why that would be necessary, unless you're also holding your
hands at a funny height above the keyboard.
> but I don't understand why that is a problem.
Human anatomy. Consider the mechanical layout of the hand/arm, with
particular reference to where all those tendons that connect your
fingers to the muscles in your arm go. (Note that "wrists straight"
is also different to "wrists stiff".)
This page on proper posture is not terrible:
http://ehs.ucdavis.edu/sftynet/sn-96.cfm
David Golden <············@oceanfree.net> wrote:
+---------------
| This page on proper posture is not terrible:
| http://ehs.ucdavis.edu/sftynet/sn-96.cfm
+---------------
Neat! Thanks for the ref! I found the "taping the fingers"
exercise particularly interesting & helpful. [Actually, I
already type that way, when I remember to... (*blush*)]
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
····@rpw3.org (Rob Warnock) writes:
> David Golden <············@oceanfree.net> wrote:
> +---------------
> | This page on proper posture is not terrible:
> | http://ehs.ucdavis.edu/sftynet/sn-96.cfm
> +---------------
>
> Neat! Thanks for the ref! I found the "taping the fingers"
> exercise particularly interesting & helpful. [Actually, I
> already type that way, when I remember to... (*blush*)]
Personally, I don't put much stock in this posture thing. My personal
theory (which has only armchair science basis but which I wish there
were actual data to support or refute) is detailed here:
http://hardware.slashdot.org/comments.pl?sid=187409&cid=15463534
- - - -
On the subject of typing parens, here are some random factoids ...
I once wrote a smart-parens feature emacs, back in the days of
TECO-based emacs when I used to write silly stuff like that. It turns
out you can pretty much always tell by looking at the character before
the paren which paren is needed except in one quite appropriate case
[the empty list]. So you could the same smart-parens command on both
paren keys, and then you have a bigger target to hit. :) (You still
have to have an empty list command, if you don't like using c-q to quote
in a close paren once in a while, but either way, it's more rare.)
INTERLISP used to have, as part of DWIM, a feature that would "fix"
stray 8's and 9's [not sure how it knew if you had a keyboard with
shift-8 and shift-9 parens or shift-9 and shift-0 parens, since
keyboards used to vary].
Along similar lines, I later put stuff in my Emacs word abbrevs that
defined things like "9setq" => "(setq", "9defun" => "(defun", etc. It
wasn't so much that I did this intentionally, but I found the best
abbrevs to define were my most common typos. (I also had all possible
permutations of t, h, and e defined to expand to "the" and quite a lot
of possible spellings for "function".)
The Lisp Machine just added lowercase paren keys (and a giant colon key
that worked both shifted and unshifted). It was a nice touch that many
liked.
On Fri, 20 Jul 2007, David Golden wrote:
> Kjetil S. Matheussen wrote:
>>
>> Really? Well, I see that my wrist is a little bit bended when typing 8
>> or 9,
>
> I can't see why that would be necessary, unless you're also holding your
> hands at a funny height above the keyboard.
>
Eh, no I don't, actually I switch positions quite often. But anyway,
something has to move when typing 8 or 9. Either the wrist moves, the
finger moves, or the elbow moves, or a combination. I don't believe moving
the wrist a little bit now and then is a problem as long as nothing hurts.
I play various musical instruments and have had smaller problems with
inflammation because of that, but I type all day long and haven't had any
inflammation problems.
>> but I don't understand why that is a problem.
>
> Human anatomy. Consider the mechanical layout of the hand/arm, with
Yeah yeah...
Kjetil S. Matheussen escreveu:
>
>
> On Fri, 20 Jul 2007, Christopher Koppler wrote:
>
>> On 20 Jul., 04:55, Matthew Swank
>> <································@c.net> wrote:
>>> On Thu, 19 Jul 2007 22:16:59 +0000, Chris Russell wrote:
>>>> try switching the () and [] keys round on the keyboard when in
>>>> lisp-mode.
>>>
>>> How do you do this locally in the mode, and not globally?
>>
>>
>> (google-group comp.lang.lisp '(remap keyboard))
>>
>
> I don't understand why switching () and [] would help. [] is accessed
> by stretching the little finger, which is very hard to do without
> moving the right hand away from standard position. (), on the other
> hand, can be typed without moving the right (or left) hand away from
> standard position.
>
Funny! In the keyboards I have access to, ( is above the upper row
numeric 9 key and ) is the same row 0 key...
Be which hand you want to use to reach Shift key we need the little
finger and move the right hand a lot...
On Sun, 22 Jul 2007, Cesar Rabak wrote:
> Kjetil S. Matheussen escreveu:
>>
>>
>> On Fri, 20 Jul 2007, Christopher Koppler wrote:
>>
>> > On 20 Jul., 04:55, Matthew Swank
>> > <································@c.net> wrote:
>> > > On Thu, 19 Jul 2007 22:16:59 +0000, Chris Russell wrote:
>> > > > try switching the () and [] keys round on the keyboard when in
>> > > > lisp-mode.
>> > >
>> > > How do you do this locally in the mode, and not globally?
>> >
>> >
>> > (google-group comp.lang.lisp '(remap keyboard))
>> >
>>
>> I don't understand why switching () and [] would help. [] is accessed
>> by stretching the little finger, which is very hard to do without
>> moving the right hand away from standard position. (), on the other
>> hand, can be typed without moving the right (or left) hand away from
>> standard position.
>>
> Funny! In the keyboards I have access to, ( is above the upper row
> numeric 9 key and ) is the same row 0 key...
>
Sorry, but whats your point?
> Be which hand you want to use to reach Shift key we need the little finger
> and move the right hand a lot...
>
Sorry again, but can you rephrase that, I don't understand that
sentence.
Kjetil S. Matheussen escreveu:
>
>
> On Sun, 22 Jul 2007, Cesar Rabak wrote:
>
>> Kjetil S. Matheussen escreveu:
>>>
>>>
>>> On Fri, 20 Jul 2007, Christopher Koppler wrote:
>>>
>>> > On 20 Jul., 04:55, Matthew Swank >
>>> <································@c.net> wrote:
>>> > > On Thu, 19 Jul 2007 22:16:59 +0000, Chris Russell wrote:
>>> > > > try switching the () and [] keys round on the keyboard when in
>>> > > > lisp-mode.
>>> > > > > How do you do this locally in the mode, and not globally?
>>> > > > (google-group comp.lang.lisp '(remap keyboard))
>>> >
>>>
>>> I don't understand why switching () and [] would help. [] is accessed
>>> by stretching the little finger, which is very hard to do without
>>> moving the right hand away from standard position. (), on the other
>>> hand, can be typed without moving the right (or left) hand away from
>>> standard position.
>>>
>> Funny! In the keyboards I have access to, ( is above the upper row
>> numeric 9 key and ) is the same row 0 key...
>>
>
> Sorry, but whats your point?
>
There is no way I can type ( or ) without moving my hand from standard
position (and I have no small hands...).
>
>
>> Be which hand you want to use to reach Shift key we need the little
>> finger and move the right hand a lot...
>>
>
> Sorry again, but can you rephrase that, I don't understand that sentence.
>
In order to get the ( and ) I have to use the Shilf key, no matter the
left or right, it needs one of the little fingers.
Cesar Rabak wrote:
> There is no way I can type ( or ) without moving my hand from standard
> position (and I have no small hands...).
...
> In order to get the ( and ) I have to use the Shift key, no matter the
> left or right, it needs one of the little fingers.
You could remap these keys to make life easier...
On an X11-based system (e.g. linux), the following commands should
swap () with [] on most US keyboards:
xmodmap -e "keysym 9 = 9 bracketleft"
xmodmap -e "keysym 0 = 0 bracketright"
xmodmap -e "keysym braceleft = parenleft braceleft"
xmodmap -e "keysym braceright = parenright braceright"
The inverse operations are
xmodmap -e "keysym 9 = 9 parenleft"
xmodmap -e "keysym 0 = 0 parenright"
xmodmap -e "keysym braceleft = bracketleft braceleft"
xmodmap -e "keysym braceright = bracketright braceright"
Later,
Daniel
D Herring escreveu:
> Cesar Rabak wrote:
>> There is no way I can type ( or ) without moving my hand from standard
>> position (and I have no small hands...).
> ...
>> In order to get the ( and ) I have to use the Shift key, no matter the
>> left or right, it needs one of the little fingers.
>
> You could remap these keys to make life easier...
[snipped]
_Could_ but it would make my life miserable when I have to use the other
(lots) of computers than not mine, which I would not be allowed to remap
keys...
> Later,
> Daniel
Regards,
--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
Cesar Rabak <·······@yahoo.com.br> writes:
> _Could_ but it would make my life miserable when I have to use the
> other (lots) of computers than not mine, which I would not be allowed
> to remap keys...
Put this in your .emacs, like all lisp hackers
(define-key lisp-mode-map (kbd "[") 'insert-parentheses)
(define-key lisp-mode-map (kbd "]") 'move-past-close-and-reindent)
On Jul 19, 1:47 am, Khookie <··········@gmail.com> wrote:
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
>
> So for the context:
>
> I don't know about you, but I think Python's use of whitespace makes
> code very pleasing to look at. I'm guessing this is partially why
> it's gotten so popular.
>
> Now the idea I'm proposing: I was thinking about this in regards to
> Lisp, and I thought, why can't it be represented like that as well?
>
> Example:
>
> test 2
> blah 2 3
> asdf 3 4 (test 156)
> setq blah 3
> bleh 15
> ...
>
> can be translated to sexprs based on whitespace:
>
> (test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
>
> >From a parsing perspective:
>
> * For every new line, prefix with a ( to create a sexpr.
> * If next line has the same level indent, close off sexpr with a ).
> * If next line is indented, don't do anything.
> * If next line is outdented, add a ), and for each level it is
> outdented, add a ).
>
> Interesting Points
> * You can still use parentheses, but they've to be on the same line.
> * I'm not sure about things like quoting & backquoting sexprs, macros,
> etc. But I imagine all potential problems are solvable, if there are
> any.
>
> What does everyone think?
Baravo. That's great Idea. You just saved lisp from being unpopular
but before we all switch to your new syntax you need to do few things:
Read all below books and finish exercises in them:
1. Gentle Introduction to symbolic computation
2. Ansi Common Lisp
3. Practical Common Lisp
4. On lisp
5. Paip
6. Object-Oriented Programming in Common Lisp
7. The Art of the Metaobject Protocol
Make at least 5 non-trivial projects using (*)lisp and if you still
think that your idea is great come back to celebrate the birth of the
new syntax.
On Jul 19, 1:47 am, Khookie <··········@gmail.com> wrote:
> Interesting Points
> * You can still use parentheses, but they've to be on the same line.
> * I'm not sure about things like quoting & backquoting sexprs, macros,
> etc. But I imagine all potential problems are solvable, if there are
> any.
>
> What does everyone think?
Hello: I am using Scheme but I think it would be a bad idea to adapt
Python style.
I mean what prevents you from using Python actually? If you feel more
comfortable with Python why not using it in your projects?
<········@gmail.com> wrote:
+---------------
| http://www.lispniks.com/faq/faq.html#s2q1
+---------------
Didn't you mean this one instead? ;-}
http://www.lispniks.com/faq/faq.html#s2q5
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
On Jul 20, 10:19 pm, ····@rpw3.org (Rob Warnock) wrote:
> <········@gmail.com> wrote:
>
> +---------------
> |http://www.lispniks.com/faq/faq.html#s2q1
> +---------------
>
> Didn't you mean this one instead? ;-}
>
> http://www.lispniks.com/faq/faq.html#s2q5
Even better.
-jimbo
"We have seen the enemy, and it is Jimbo." - Ken Tilton on
comp.lang.lisp
Actually I am a newbie in lisp and I find the parentheses quite
comforting to have.
It feels like a safety net against syntax errors. And it also helps
with reading code, and given an IDE to work with (I use SLIME) it is
*very* "eye-friendly". Meaning that trying to read lisp code at 3 am
in preparation for some project you should have delivered to your
professor days ago is far less painful than what I have experienced
with java or C. Don't know about python though... Thus I can say that
this will most likely turn to be my favorite syntax so far.
Rob Warnock wrote:
> <········@gmail.com> wrote:
> +---------------
> | http://www.lispniks.com/faq/faq.html#s2q1
> +---------------
>
> Didn't you mean this one instead? ;-}
>
> http://www.lispniks.com/faq/faq.html#s2q5
No, we are looking for the one that begins "Die! Die you unworthy scum!".
hth, kxo
It's been suggested many times before and I still think it's a good
idea. Personally I think something a little more malleable than just
a white space translation but it's a good start.
On Jul 18, 4:47 pm, Khookie <··········@gmail.com> wrote:
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
>
> So for the context:
>
> I don't know about you, but I think Python's use of whitespace makes
> code very pleasing to look at. I'm guessing this is partially why
> it's gotten so popular.
>
> Now the idea I'm proposing: I was thinking about this in regards to
> Lisp, and I thought, why can't it be represented like that as well?
>
> Example:
>
> test 2
> blah 2 3
> asdf 3 4 (test 156)
> setq blah 3
> bleh 15
> ...
>
> can be translated to sexprs based on whitespace:
>
> (test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
>
> >From a parsing perspective:
>
> * For every new line, prefix with a ( to create a sexpr.
> * If next line has the same level indent, close off sexpr with a ).
> * If next line is indented, don't do anything.
> * If next line is outdented, add a ), and for each level it is
> outdented, add a ).
>
> Interesting Points
> * You can still use parentheses, but they've to be on the same line.
> * I'm not sure about things like quoting & backquoting sexprs, macros,
> etc. But I imagine all potential problems are solvable, if there are
> any.
>
> What does everyone think?
Sorry my bad. I now realise for things like DSL programming, and
if (eq *blah* 123)
print "true condition here"
print "false condition here"
it probably wouldn't make much sense.
I guess I'm still thinking in that imperative programming mindset, whereas
Lisp has a much more flexible expression.
Chris
"Khookie" <··········@gmail.com> wrote in message
·····························@d30g2000prg.googlegroups.com...
> Hi everyone
>
> Just had an idea this morning - don't know how good it is tho since
> I'm very new to Lisp. Would like to get some feedback:-
>
> So for the context:
>
> I don't know about you, but I think Python's use of whitespace makes
> code very pleasing to look at. I'm guessing this is partially why
> it's gotten so popular.
>
> Now the idea I'm proposing: I was thinking about this in regards to
> Lisp, and I thought, why can't it be represented like that as well?
>
> Example:
>
> test 2
> blah 2 3
> asdf 3 4 (test 156)
> setq blah 3
> bleh 15
> ...
>
> can be translated to sexprs based on whitespace:
>
> (test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)
>
>>From a parsing perspective:
> * For every new line, prefix with a ( to create a sexpr.
> * If next line has the same level indent, close off sexpr with a ).
> * If next line is indented, don't do anything.
> * If next line is outdented, add a ), and for each level it is
> outdented, add a ).
>
> Interesting Points
> * You can still use parentheses, but they've to be on the same line.
> * I'm not sure about things like quoting & backquoting sexprs, macros,
> etc. But I imagine all potential problems are solvable, if there are
> any.
>
> What does everyone think?
>