From: webmasterATflymagnetic.com
Subject: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186865881.802540.272800@d55g2000hsg.googlegroups.com>
I'm really new to Lisp -- I'm trying it out to see if the language
really is magic (I've seen a couple of programs that *I think* I
understand, and they look really neat) but it's hurting my head! Can
someone please explain why this happens? I'm using Clisp 2.41. I've
written this in notepad:

(dotimes (x 20)
	(dotimes (y 20)
		(format t "~3d " (* x y))
	)
	(format t "~%")
)


*All* indentation is with TABs. Yet I get this output when I paste it
into the interpreter:

[20]> (dotimes (x 20)

Help (abbreviated :h) = this list
Use the usual editing capabilities.
(quit) or (exit) leaves CLISP.
(dotimes (y 20)

Help (abbreviated :h) = this list
Use the usual editing capabilities.
(quit) or (exit) leaves CLISP.

Help (abbreviated :h) = this list
Use the usual editing capabilities.
(quit) or (exit) leaves CLISP.
(format t "~3d " (* x y))

Help (abbreviated :h) = this list
Use the usual editing capabilities.
(quit) or (exit) leaves CLISP.
)

Help (abbreviated :h) = this list
Use the usual editing capabilities.
(quit) or (exit) leaves CLISP.
(format t "~%")
)
  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
0   0   0

  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16
17  18  19

  0   2   4   6   8  10  12  14  16  18  20  22  24  26  28  30  32
34  36  38

...


Can someone please explain what is going on? If I replace the TABs
with SPACEs I don't get all that Help... stuff. Is TAB something
special in Lisp? I thought it would be just whitespace, and so eaten
up by the tokeniser.

I'd like to make two points in anticipation of any responses.

* I always use TABs to indent my code, and I'll not be deflected by
those that argue that spaces are better.
* I've seen it written somewhere that good Lisp style is not to line
those )s up under their corresponding (, but to have them all trailing
at the end of the expression. That may be the case, but as I said
above I'm new to Lisp and as I have 25 years or so of programming
experience it's going to take a while to change if that is the case
(but the TABs must stay!!).

From: Gene
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186874453.447580.42720@r34g2000hsd.googlegroups.com>
On Aug 11, 4:58 pm, "webmasterATflymagnetic.com"
<·········@flymagnetic.com> wrote:
> I'd like to make two points in anticipation of any responses.
>
> * I always use TABs to indent my code, and I'll not be deflected by
> those that argue that spaces are better.
> * I've seen it written somewhere that good Lisp style is not to line
> those )s up under their corresponding (, but to have them all trailing
> at the end of the expression. That may be the case, but as I said
> above I'm new to Lisp and as I have 25 years or so of programming
> experience it's going to take a while to change if that is the case
> (but the TABs must stay!!).

Trust me.  (I've been programming for 35 years.)  Learn the community
convention for the language you're using at the moment.  The trivial
cost of adjusting your habits and outlook will be paid back many, many
times.  E.g. programmers who are pedantic about meaningless details
like space vs. tab are displaying a way of thinking inconsistent with
good programming.
From: Zach Beane
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <m3odhdg37q.fsf@unnamed.xach.com>
"webmasterATflymagnetic.com" <·········@flymagnetic.com> writes:

> Can someone please explain what is going on? 

The friendly interactive readline interface of clisp is processing tabs in the
repl as requests for command completion.

One way to work around it is to write your Lisp source into files and
use (load "myfile.lisp") from the REPL to load them. The tab character
won't be an issue there.

> * I always use TABs to indent my code, and I'll not be deflected by
> those that argue that spaces are better.
> * I've seen it written somewhere that good Lisp style is not to line
> those )s up under their corresponding (, but to have them all trailing
> at the end of the expression. That may be the case, but as I said
> above I'm new to Lisp and as I have 25 years or so of programming
> experience it's going to take a while to change if that is the case
> (but the TABs must stay!!).

I hope it won't take another 25 years for you to start using normal
Lisp style.

Zach
From: webmasterATflymagnetic.com
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186869716.557028.152250@l70g2000hse.googlegroups.com>
Cool, thanks for the explanation. So I have to live with this. I have
already tried as you suggested using load and noticed that the
messages don't appear.

As to the layout, it seems very sensible to me to line up the
parentheses, especially as Lisp positively thrives on them! Notepad
will clearly not highlight a matching bracket, and I'm not aware of an
IDE that I could use (is there a plug-in for Eclipse?), so I may be
laying my code out like Java for a while, and then collapsing them
into strings of )s when I know the program works.

Thanks for your reply!

P
From: Zach Beane
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <m3k5s1g0du.fsf@unnamed.xach.com>
"webmasterATflymagnetic.com" <·········@flymagnetic.com> writes:

> As to the layout, it seems very sensible to me to line up the
> parentheses, especially as Lisp positively thrives on them! Notepad
> will clearly not highlight a matching bracket, and I'm not aware of an
> IDE that I could use (is there a plug-in for Eclipse?)

There are *two* plugins for Eclipse, Cusp and
Dandelion-ECL. I like using Emacs and SLIME, and if I used Windows I'd
probably use it there too. There are also complete commercial Lisp
IDEs for Windows, including LispWorks, Allegro CL, and Corman
Lisp. They all support normal formatting for CL code.

Zach
From: Pascal Bourguignon
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <87hcn5hctz.fsf@informatimago.com>
"webmasterATflymagnetic.com" <·········@flymagnetic.com> writes:

> Cool, thanks for the explanation. So I have to live with this. I have
> already tried as you suggested using load and noticed that the
> messages don't appear.

Well, if you persist in NOT reading the Implementation NOTES, yes, I
assume you will have to live with it...  Even man clisp should tell
you something!


> As to the layout, it seems very sensible to me to line up the
> parentheses, especially as Lisp positively thrives on them! Notepad
> will clearly not highlight a matching bracket, and I'm not aware of an
> IDE that I could use (is there a plug-in for Eclipse?), so I may be
> laying my code out like Java for a while, and then collapsing them
> into strings of )s when I know the program works.

emacs is THE lisp IDE.  


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
From: webmasterATflymagnetic.com
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186880182.148701.205740@w3g2000hsg.googlegroups.com>
Thanks guys. I've found the implementation notes -- code completion,
so it makes more sense now!

I'll also look into the Eclipse plug-in.

Lot of food for thought!

Thanks again.

P
From: Pascal Bourguignon
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <874pj5h73u.fsf@informatimago.com>
"webmasterATflymagnetic.com" <·········@flymagnetic.com> writes:

> Thanks guys. I've found the implementation notes -- code completion,
> so it makes more sense now!

In emacs (and others IDE), use   clisp -I ...  to disable this special
treatment of TAB.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
From: Rob Warnock
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <yLKdnd7pjOyT8yPbnZ2dnUVZ_jydnZ2d@speakeasy.net>
Pascal Bourguignon  <···@informatimago.com> wrote:
+---------------
| "webmasterATflymagnetic.com" <·········@flymagnetic.com> writes:
| > As to the layout, it seems very sensible to me to line up the
| > parentheses, especially as Lisp positively thrives on them! Notepad
| > will clearly not highlight a matching bracket, and I'm not aware of an
| > IDE that I could use (is there a plug-in for Eclipse?), so I may be
| > laying my code out like Java for a while, and then collapsing them
| > into strings of )s when I know the program works.
| 
| emacs is THE lisp IDE.  
+---------------

That is indeed the politically-correct answer, but it would be good
if newbies occasionally hear that not *everyone* who productively
uses Lisp to get real work done uses the politically-correct IDE.
[Some of us even use (*gasp*) "Vi", and *prefer* it. Oh, the horror...]

*DO NOT* let the lack of a politically-correct IDE, or indeed *any*
IDE, stop you from using Lisp to get work done. One can usefully code
in Lisp with *any* editor, even Notepad. [Some Emacs bigots may have
heart attacks at this news. Tough.]

Now, it is also true that it's far easier to code good Lisp if one's
editor has at least these three capabilities:

1. Simple auto-indentation to the same level as the previous line
   when you type a newline [e.g., ":set autoindent" in Vi], though it
   *is* absolutely essential that your editor permit such indentation
   to be on *any* character position, not just at special "tab settings"
   [unless you can set a "tab setting" at every single character
   position!]; 

2. The ability to shift groups of lines back & forth [e.g., the
   "<<" & ">>" commands in Vi], and even better [though not absolutely
   necessary], shift whole s-exprs back & forth [e.g., the "<%" & ">%"
   commands in Vi]; and,

3. Parentheses-matching, that is, will blink or otherwise show
   you the matching open parenthesis when you type a closing one
   [e.g., ":set showmatch" in Vi], and also provides a simple way
   to jump back & forth between pairs of matching open & closed
   parentheses [e.g., the "%" command in Vi].

The classical indentation rules for Lisp are simple enough that 
the above three capabilities are all you *really* need to be *very*
productive in Lisp while still writing code that adheres to community
indentation standards. Just pick any editor with which you are
comfortable that offers at least these three features, and start
coding!!  Happy Lisp-ing!


-Rob

p.s. The above is *NOT* an anti-Emacs rant, but in instead a pro-Lisp
"Just do it!" rant. Obviously, given the great enthusiasm seasoned
Emacs or Emacs+Slime users have for their chosen IDE, there are
plenty of *additional* productivity advantages to be gained by
using "the one and only true Lisp IDE", but *any* editor with the
above three capabilities will get you 80% of the way, and that's all
you need to get started coding and doing useful stuff. And getting
experience in *coding* & *running* Lisp is really what's important!!
[Right, Kenny?]

Later, if you want to investigate various IDEs, fine.

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: webmasterATflymagnetic.com
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186917861.619572.262200@w3g2000hsg.googlegroups.com>
> [Some of us even use (*gasp*) "Vi", and *prefer* it. Oh, the horror...]
Really, you can use the world's best editor for Lisp? ;)

> 2. The ability to shift groups of lines back & forth [e.g., the
>    "<<" & ">>" commands in Vi], and even better [though not absolutely
>    necessary], shift whole s-exprs back & forth [e.g., the "<%" & ">%"
>    commands in Vi]; and,
Gasp, it really works -- cool!!
>
> 3. Parentheses-matching, that is, will blink or otherwise show
>    you the matching open parenthesis when you type a closing one
>    [e.g., ":set showmatch" in Vi], and also provides a simple way
>    to jump back & forth between pairs of matching open & closed
>    parentheses [e.g., the "%" command in Vi].
Well bugger me with a fish-fork -- set sm, wonderful!

So vi it is, guys. I'm converted!

P
From: Thomas F. Burdick
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186904525.182725.291750@57g2000hsv.googlegroups.com>
On Aug 12, 4:18 am, ····@rpw3.org (Rob Warnock) wrote:
> Now, it is also true that it's far easier to code good Lisp if one's
> editor has at least these three capabilities:
>
> 1. Simple auto-indentation to the same level as the previous line
>    when you type a newline [e.g., ":set autoindent" in Vi], though it
>    *is* absolutely essential that your editor permit such indentation
>    to be on *any* character position, not just at special "tab settings"
>    [unless you can set a "tab setting" at every single character
>    position!];
>
> 2. The ability to shift groups of lines back & forth [e.g., the
>    "<<" & ">>" commands in Vi], and even better [though not absolutely
>    necessary], shift whole s-exprs back & forth [e.g., the "<%" & ">%"
>    commands in Vi]; and,
>
> 3. Parentheses-matching, that is, will blink or otherwise show
>    you the matching open parenthesis when you type a closing one
>    [e.g., ":set showmatch" in Vi], and also provides a simple way
>    to jump back & forth between pairs of matching open & closed
>    parentheses [e.g., the "%" command in Vi].

Leaving, what ... the various Emacs-like editors and
(re)implementations of Vi?
From: Rob Warnock
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <-dGdnUMn1cocj13bnZ2dnUVZ_tvinZ2d@speakeasy.net>
Thomas F. Burdick <········@gmail.com> wrote:
+---------------
| On Aug 12, 4:18 am, ····@rpw3.org (Rob Warnock) wrote:
| > Now, it is also true that it's far easier to code good Lisp if one's
| > editor has at least these three capabilities:
| > 1. Simple auto-indentation to the same level as the previous line...
| > 2. The ability to shift groups of lines back & forth ...
| > 3. Parentheses-matching, that is, will blink or otherwise show
| >    you the matching open parenthesis when you type a closing one...
| 
| Leaving, what ... the various Emacs-like editors and
| (re)implementations of Vi?
+---------------

Certainly those two, but it's not unimaginable that there are
a bunch of other editors running on, say, Windows or the Mac
[neither of which I use, so I don't know what's available there
and what's not] that have at least those these three capabilities.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Rainer Joswig
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <joswig-8654D1.13574112082007@news-europe.giganews.com>
In article <································@speakeasy.net>,
 ····@rpw3.org (Rob Warnock) wrote:

> Pascal Bourguignon  <···@informatimago.com> wrote:
> +---------------
> | "webmasterATflymagnetic.com" <·········@flymagnetic.com> writes:
> | > As to the layout, it seems very sensible to me to line up the
> | > parentheses, especially as Lisp positively thrives on them! Notepad
> | > will clearly not highlight a matching bracket, and I'm not aware of an
> | > IDE that I could use (is there a plug-in for Eclipse?), so I may be
> | > laying my code out like Java for a while, and then collapsing them
> | > into strings of )s when I know the program works.
> | 
> | emacs is THE lisp IDE.  
> +---------------
> 
> That is indeed the politically-correct answer,

The even more politically-correct answer is Hemlock. Hemlock is written
in Common Lisp. Various versions are in use. CMUCL uses it.
LispWorks' editor is based on Hemlock (though changed a bit now).
OpenMCL has a version of Hemlock.

> but it would be good
> if newbies occasionally hear that not *everyone* who productively
> uses Lisp to get real work done uses the politically-correct IDE.
> [Some of us even use (*gasp*) "Vi", and *prefer* it. Oh, the horror...]
> 
> *DO NOT* let the lack of a politically-correct IDE, or indeed *any*
> IDE, stop you from using Lisp to get work done. One can usefully code
> in Lisp with *any* editor, even Notepad. [Some Emacs bigots may have
> heart attacks at this news. Tough.]

Not really. You can also get work done with a bare terminal
(maybe with some line-editing functionality).

> 
> Now, it is also true that it's far easier to code good Lisp if one's
> editor has at least these three capabilities:
> 
> 1. Simple auto-indentation to the same level as the previous line
>    when you type a newline [e.g., ":set autoindent" in Vi], though it
>    *is* absolutely essential that your editor permit such indentation
>    to be on *any* character position, not just at special "tab settings"
>    [unless you can set a "tab setting" at every single character
>    position!]; 
> 
> 2. The ability to shift groups of lines back & forth [e.g., the
>    "<<" & ">>" commands in Vi], and even better [though not absolutely
>    necessary], shift whole s-exprs back & forth [e.g., the "<%" & ">%"
>    commands in Vi]; and,
> 
> 3. Parentheses-matching, that is, will blink or otherwise show
>    you the matching open parenthesis when you type a closing one
>    [e.g., ":set showmatch" in Vi], and also provides a simple way
>    to jump back & forth between pairs of matching open & closed
>    parentheses [e.g., the "%" command in Vi].

I would add that it would be fine if the editor could
send expressions to a Lisp and get the results back.

> 
> The classical indentation rules for Lisp are simple enough that 
> the above three capabilities are all you *really* need to be *very*
> productive in Lisp while still writing code that adheres to community
> indentation standards. Just pick any editor with which you are
> comfortable that offers at least these three features, and start
> coding!!  Happy Lisp-ing!
> 
> 
> -Rob
> 
> p.s. The above is *NOT* an anti-Emacs rant, but in instead a pro-Lisp
> "Just do it!" rant.

Obviously it is a pro-Vi rant. ;-)

> Obviously, given the great enthusiasm seasoned
> Emacs or Emacs+Slime users have for their chosen IDE, there are
> plenty of *additional* productivity advantages to be gained by
> using "the one and only true Lisp IDE", but *any* editor with the
> above three capabilities will get you 80% of the way, and that's all
> you need to get started coding and doing useful stuff. And getting
> experience in *coding* & *running* Lisp is really what's important!!
> [Right, Kenny?]
> 
> Later, if you want to investigate various IDEs, fine.
> 
> -----
> Rob Warnock			<····@rpw3.org>
> 627 26th Avenue			<URL:http://rpw3.org/>
> San Mateo, CA 94403		(650)572-2607

-- 
http://lispm.dyndns.org
From: ···············@gmail.com
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <1186936621.882687.87040@22g2000hsm.googlegroups.com>
On Aug 12, 12:57 pm, Rainer Joswig <······@lisp.de> wrote:

> The even more politically-correct answer is Hemlock. Hemlock is written
> in Common Lisp. Various versions are in use. CMUCL uses it.
> LispWorks' editor is based on Hemlock (though changed a bit now).
> OpenMCL has a version of Hemlock.


Or ABLE (http://phil.nullable.eu/) which is also written in Common
Lisp.

-- Phil
http://phil.nullable.eu/
From: Rob Warnock
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <BIudnda2I4vyi13bnZ2dnUVZ_qOknZ2d@speakeasy.net>
Rainer Joswig  <······@lisp.de> wrote:
+---------------
| I would add that it would be fine if the editor could
| send expressions to a Lisp and get the results back.
+---------------

It might be nice [though I personally don't feel the lack],
and I've heard rumors that some versions of that have been
hacked into Vim [which I don't use], but do you really feel
that it's anywhere near as important as the three capabilities
I listed? It seems to me to be more like icing on the cake:
nice, and tasty [if you have a taste for that], but not as
fundamental as the others. YMMV.

Disclaimer: I'm using X Windows, so copy & paste from an
editor window to a REPL window is a mouse sweep and a click,
and having multiple windows open is not an issue.

+---------------
| > p.s. The above is *NOT* an anti-Emacs rant, but in instead a pro-Lisp
| > "Just do it!" rant.
| 
| Obviously it is a pro-Vi rant. ;-)
+---------------

No, it really was a pro-Lisp "Just do it!" rant. While I *personally*
happen to have trouble with Emacs and not with Vi, others may prefer
Emacs or Hemlock [thanks for the reminder! -- and me a CMUCL user, too!
(*blush*)] or ACL's or Lispworks's built-in IDE or some editor I don't
even know about on Windows or whatever...

What's important for newbies is to get past all the IDE hangups
and just code some Lisp that does something more than (+ 1 2),
whatever you have to use to do that. Icing and even cake can
come later.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Matthias Buelow
Subject: Re: Why do I get error messages when using tabs?
Date: 
Message-ID: <5i90gmF3o9n14U1@mid.dfncis.de>
webmasterATflymagnetic.com wrote:
> I'm really new to Lisp -- I'm trying it out to see if the language
> really is magic (I've seen a couple of programs that *I think* I
> understand, and they look really neat) but it's hurting my head! Can
> someone please explain why this happens? I'm using Clisp 2.41. I've
> written this in notepad:

Start clisp as clisp -I or put the following in $HOME/.inputrc:

$if Clisp
    TAB:self-insert
$endif