Is there a tutorial out there which explains how to make the most
of the REPL? My current usage is something like...
* Open an editor in one window, and start a lisp image in another.
* Type a definition or two and some tests into the editor, save, and
then "load" into lisp.
* Run some tests, rinse, repeat.
...Is there something more/better that I should be doing? How do I
learn about the features like "*" being the previously evaluated value,
etc. I'm currently using CMUCL, and one thing I've noticed is that I
can't use the arrow keys for editing (like having the up-arrow retrieve
the last expression entered, etc.). Do I need to compile in a version
of Readline, or some such? Are the cursor navigation commands bound to
other keys? Is this just a limitation of CMUCL, and I should try
another Lisp variant? (I've browsed the CMUCL User's Manual, but
haven't been able to find the section that talks about the REPL).
Thanks,
Greg Buchholz
Greg Buchholz wrote:
> Is there a tutorial out there which explains how to make the most
> of the REPL? My current usage is something like...
>
> * Open an editor in one window, and start a lisp image in another.
> * Type a definition or two and some tests into the editor, save, and
> then "load" into lisp.
> * Run some tests, rinse, repeat.
Also, when you are using emacs with lisp, you can eidt/change one
definition and send that changed part only to the REPL.
There will not be a need to load the entire file after you make a small
change.
You can split your emacs window into two windows [(C-x 2)]. You can
edit your lisp code in the top window and have your slime REPL running
in the other window. In your lisp editor window, if you highlight and
enter C-c C-r , the entire region you highlighted will be evaluated in
the REPL. There are many other such commands for evaluation and
compiling. Please see the SLIME tab for your buffer containing the lisp
code.
If you've never used EMACS, don't worry. It won't take too long to
learn. It is such a crime if you're not using a good environment when
working with lisp code. The commercial lisps have their own IDEs. But
many people use just emacs/slime. It is really cool.
Which CL implementation are you using? You can check out lisp-in-a-box
at
http://www.gigamonkeys.com/lispbox/
It comes with lost of stuff configured already and you can use
emace/slime out of the box.
Hope this helps. I will try to find some links which will show you how
to use just emacs or emacs/slime to edit your code and run REPL
together.
Aravindh Johendran wrote:
> Also, when you are using emacs with lisp, you can eidt/change one
> definition and send that changed part only to the REPL.
> There will not be a need to load the entire file after you make a small
> change.
Why would one care if the entire file was loaded after a small
change? Is the load time going to be a problem for large files? Or
are there other potential problems?
> If you've never used EMACS, don't worry. It won't take too long to
> learn. It is such a crime if you're not using a good environment when
> working with lisp code.
Unfortunately, I'm going to be a heretic and stick with Vim for the
time being. (if its good enough for Paul Graham, its good enough for
me ;-)
Thanks,
Greg Buchholz
"Greg Buchholz" <················@yahoo.com> writes:
> Aravindh Johendran wrote:
>> Also, when you are using emacs with lisp, you can eidt/change one
>> definition and send that changed part only to the REPL.
>> There will not be a need to load the entire file after you make a small
>> change.
>
> Why would one care if the entire file was loaded after a small
> change? Is the load time going to be a problem for large files? Or
> are there other potential problems?
If you make a ton of changes and decide to test one out in the middle
before finishing the others, it makes sense to do this. I rarely use
a compile/load command other than C-c C-k, though.
>> If you've never used EMACS, don't worry. It won't take too long to
>> learn. It is such a crime if you're not using a good environment when
>> working with lisp code.
>
> Unfortunately, I'm going to be a heretic and stick with Vim for the
> time being. (if its good enough for Paul Graham, its good enough for
> me ;-)
I'm a lifelong vi person. I still use it for much of my editing,
especially regular text files and C code. However, I have switched to
Emacs for several things, including the following (in order of adoption):
1. Prose
2. LaTeX
3. Lisp
4. Usenet
5. IRC
I remain proficient with vi and am becoming good enough with Emacs
that none of the above is often painful in it. Because of the tools
that are available to make Emacs and Lisp work well together, I stand
by my recommendation that you pick it up.
You could also try Viper, the vi emulation mode for Emacs. I tried it
out but found learning Emacs was more productive. I run MacOS X, so
Emacs key bindings are also useful all over the place, including
textareas and the address bar in Safari and the entry box in IM
windows.
That said, if you are using vim, you could try Vilisp:
http://www.vim.org/scripts/script.php?script_id=221
You may also want to play with GNU clisp (if it's good enough for Paul
Graham, it's good enough for you, right?), since it offers tab
completion, command-line editing, and a command history at its REPL
that will make life easier until you decide to switch to a Lisp IDE
like Slime.
On 4 May 2006 11:42:04 -0700, "Greg Buchholz"
<················@yahoo.com> tried to confuse everyone with this
message:
>Aravindh Johendran wrote:
>> Also, when you are using emacs with lisp, you can eidt/change one
>> definition and send that changed part only to the REPL.
>> There will not be a need to load the entire file after you make a small
>> change.
>
> Why would one care if the entire file was loaded after a small
>change? Is the load time going to be a problem for large files?
Yes, if your file contains a lot of code, it would not load quickly.
You'll also get a lot of warnings about redefining functions, classes
and so on, which I consider rather annoying. Also, consider the
following scenario:
*You load the file and run your program
*The program stops due to some bug.
*You know that the bug happens only under some circumstances, because it
didn't happen before.
*You make a change to the code, hoping to fix the bug, and reload the
whole file.
*The program doesn't crash this time. The bug appears to be fixed, but
is it?
Since you reloaded the whole file some things have changed (global
variables got reset to their initial values and so on), and you cannot
reproduce the same circumstances that caused the error. Worse yet, some
variables may have _not_ reset, which may cause some problems that
couldn't happen with a freshly started Lisp.
So, I really don't recommend loading one file two times during a single
Lisp session.
--
|WAR HAS NEVER SOLVED ANYTHING|,----- Timofei Shatrov aka Grue---------.
|(except for ending slavery, ||mail: grue at mail.ru ================ |
| fascism and communism) ||============= http://grue3.tripod.com |
|...and Saddam's dictatorship |`----------------------------------[4*72]
Greg Buchholz wrote:
> (if its good enough for Paul Graham, its good enough for
> me ;-)
you poor sheep
Timofei Shatrov wrote:
> So, I really don't recommend loading one file two times during a single
> Lisp session.
Good helpful explanation there Timofei. I wrote something like what you
did but deleted it since the thread starter didn't seem too intent on
considering the merit of dispensed suggestions/advice.
Sigh ..... he's going to miss half the fun of programming/development
using REPL.
Aravindh Johendran wrote:
>
> Good helpful explanation there Timofei. I wrote something like what you
> did but deleted it since the thread starter didn't seem too intent on
> considering the merit of dispensed suggestions/advice.
> Sigh ..... he's going to miss half the fun of programming/development
> using REPL.
That's what this thread is for. I'm specifically looking for
documentation to tell me what advantages the REPL provides and how to
best use it. So you think an automated way to cut and paste
definitions into an image is crucial. Excellent. Something like that
can be easily ginned up in any editor. What else is there?
Thanks,
Greg Buchholz
"Greg Buchholz" <················@yahoo.com> writes:
> Aravindh Johendran wrote:
>>
>> Good helpful explanation there Timofei. I wrote something like what you
>> did but deleted it since the thread starter didn't seem too intent on
>> considering the merit of dispensed suggestions/advice.
>> Sigh ..... he's going to miss half the fun of programming/development
>> using REPL.
>
> That's what this thread is for. I'm specifically looking for
> documentation to tell me what advantages the REPL provides and how to
> best use it. So you think an automated way to cut and paste
> definitions into an image is crucial. Excellent. Something like that
> can be easily ginned up in any editor. What else is there?
This is the attitude that he was referring to. How about giving it a
try instead of demanding solutions to unspecified problems after
shooting down the one suggestion that has been consistently made, on
the sole grounds that emulating Paul Graham is more important than
taking others' advice? You may have better luck just asking Paul
Graham directly if you're unwilling to take advice from anyone else.
Ari Johnson wrote:
> "Greg Buchholz" <················@yahoo.com> writes:
>
> This is the attitude that he was referring to. How about giving it a
> try instead of demanding solutions to unspecified problems after
> shooting down the one suggestion that has been consistently made, on
> the sole grounds that emulating Paul Graham is more important than
> taking others' advice? You may have better luck just asking Paul
> Graham directly if you're unwilling to take advice from anyone else.
??? What? I don't even really know how to reply. Demanding
solutions? Huh? Unspecified problems? Problems? What problems?
Unwilling to take advice? Emulate the worshipful Paul Graham? Didn't
I add the smiley? Where in the world did all that defensiveness come
from? Is there some secret handshake that I missed? Or is this some
kind of "The Social Problems of Lisp" parody? ???
Greg Buchholz
"Greg Buchholz" <················@yahoo.com> writes:
> Ari Johnson wrote:
>> "Greg Buchholz" <················@yahoo.com> writes:
>>
>> This is the attitude that he was referring to. How about giving it a
>> try instead of demanding solutions to unspecified problems after
>> shooting down the one suggestion that has been consistently made, on
>> the sole grounds that emulating Paul Graham is more important than
>> taking others' advice? You may have better luck just asking Paul
>> Graham directly if you're unwilling to take advice from anyone else.
>
> ??? What? I don't even really know how to reply. Demanding
> solutions? Huh? Unspecified problems? Problems? What problems?
> Unwilling to take advice? Emulate the worshipful Paul Graham? Didn't
> I add the smiley? Where in the world did all that defensiveness come
> from? Is there some secret handshake that I missed? Or is this some
> kind of "The Social Problems of Lisp" parody? ???
I misread you, perhaps. I think it was your seeming dismissal of how
to do incremental compilation under Emacs as nothing special while in
reality you seem not to have even tried it. I apologize if I was way
off. It happens sometimes online. And yes, you forgot a smiley or
two. :P
Regardless, take the others' advice and watch the video of Slime in
action. It's worth it just to see how most of the people around here
do their Lisp work. And then you can make an informed decision about
whether or not to stick with vim.
The lack of advice you get for how to be effective with vim and Lisp
comes mostly from the fact that hardly anyone knows how. Most people
find Emacs and Slime perfectly good, while others prefer commercial
Lisp IDE's such as Lispworks. You can try the free-for-personal-use
Lispworks to see what that's all about.
All I'm really saying is to give it a shot. I was anti-Emacs and a vi
(and later vim) addict for a long time, and remain a dedicated vi user
where it is appropriate - I just happened to discover that some things
can be done much more efficiently in Emacs.
Ari Johnson wrote:
> I misread you, perhaps. I think it was your seeming dismissal of how
> to do incremental compilation under Emacs as nothing special while in
> reality you seem not to have even tried it. I apologize if I was way
> off. It happens sometimes online. And yes, you forgot a smiley or
> two. :P
No problem. Sorry if I seemed dismissive.
> Regardless, take the others' advice and watch the video of Slime in
> action. It's worth it just to see how most of the people around here
> do their Lisp work. And then you can make an informed decision about
> whether or not to stick with vim.
Downloading as we speak.
> The lack of advice you get for how to be effective with vim and Lisp
> comes mostly from the fact that hardly anyone knows how.
I guess I wasn't looking for specific advice on being effective with
vim. Just general advice, like Mr. Murtezaoglu's above on how you
learn about things like +, ++, +++, which I had no idea existed. I
thought things like that might be more implementation specific, but I
couldn't find much in the CMUCL docs. I guess I'll be taking a closer
look at the spec.
> All I'm really saying is to give it a shot. I was anti-Emacs and a vi
> (and later vim) addict for a long time, and remain a dedicated vi user
> where it is appropriate - I just happened to discover that some things
> can be done much more efficiently in Emacs.
Oh, I'm not as much anti-Emacs as I am lazy and unenthusiastic about
contorting my hands to be constantly on the control keys, but that's a
different flame war.
Thanks,
Greg Buchholz
"Greg Buchholz" <················@yahoo.com> writes:
> I guess I wasn't looking for specific advice on being effective with
> vim. Just general advice, like Mr. Murtezaoglu's above on how you
> learn about things like +, ++, +++, which I had no idea existed. I
> thought things like that might be more implementation specific, but I
> couldn't find much in the CMUCL docs. I guess I'll be taking a closer
> look at the spec.
Definitely keep the HyperSpec close at hand. It's to Lisp what man(1)
is to C. :)
> Oh, I'm not as much anti-Emacs as I am lazy and unenthusiastic about
> contorting my hands to be constantly on the control keys, but that's a
> different flame war.
I suppose it helps that I used to play piano and still play guitar, so
left-hand "chords" aren't all that rough for me. :)
"Greg Buchholz" <················@yahoo.com> writes:
> Aravindh Johendran wrote:
>>
>> Good helpful explanation there Timofei. I wrote something like what you
>> did but deleted it since the thread starter didn't seem too intent on
>> considering the merit of dispensed suggestions/advice.
>> Sigh ..... he's going to miss half the fun of programming/development
>> using REPL.
>
> That's what this thread is for. I'm specifically looking for
> documentation to tell me what advantages the REPL provides and how to
> best use it. So you think an automated way to cut and paste
> definitions into an image is crucial. Excellent. Something like that
> can be easily ginned up in any editor. What else is there?
>
> Thanks,
>
> Greg Buchholz
>
If you are unconvinced of SLIME's superiority , watch Marco Baringer's
SLIME video:
http://common-lisp.net/movies/slime.mov
http://common-lisp.net/movies/slime.torrent
It is 55 minutes long, but you should start picking up right away how
much better life is when coding in SLIME. At least give it a try. It
would be sad to see you miss out on 80% of the fun of Lisp coding
simply because Paul Graham is misguided.
--
This is a song that took me ten years to live and two years to write.
- Bob Dylan
Bill Atkins <············@rpi.edu> wrote in ···················@rpi.edu:
>
> If you are unconvinced of SLIME's superiority , watch Marco Baringer's
> SLIME video:
>
> http://common-lisp.net/movies/slime.mov
> http://common-lisp.net/movies/slime.torrent
>
> It is 55 minutes long, but you should start picking up right away how
> much better life is when coding in SLIME. At least give it a try. It
> would be sad to see you miss out on 80% of the fun of Lisp coding
> simply because Paul Graham is misguided.
>
Very nice presentation.
Thanks
If you do want to stick with vim (I do, too), I definitely suggest to
either use clisp (that has or can have readline built-in) or
incorporate readline into your lisp via ffi (cliki sais it has already
been done in some cases).
Then, you can assign lisp functions to the keystrokes - look at my
settings at http://www.volny.cz/zellerin/texts/readline.lisp and
http://www.volny.cz/zellerin/texts/clisprl for inspiration (you
probably wont be able to use them directly). They allow, e.g., reload
asdf package by C-xC-l etc.
No tutorial - look at the readline bindings and then assign what you
want to a key you think appropriate (it might be convenient to keep
them same as in slime, but I never got into slime)
Tomas
On 2006-05-05, ········@gmail.com <········@gmail.com> wrote:
> If you do want to stick with vim (I do, too), I definitely suggest
> to either use clisp (that has or can have readline built-in) or
> incorporate readline into your lisp via ffi (cliki sais it has
> already been done in some cases).
Some other possibilities for sticking with Vim: VILisp[1] or
Vim+ECL[2], and if you have some extra time and want to join other
like-minded folks, read/join the Slim-Vim mailing list[3]. There are
some other[4] web pages out there on doing Lisp effectively in Vim.
Fair warning: Emacs+Slime is mature, featureful, documented, (mostly)
bug-free, and has binaries available for download. Vim is all that,
too, but the Lisp interface isn't. If you have some time and want to
help, we'd welcome the assistance.
Some of the things Vim+ECL has going for it, though: it's Vim. It's
Common Lisp, not elisp. And you can compile the Lisp to machine code,
just like normal ECL, and load it into Vim.
-- Larry
[1] http://vim.sourceforge.net/scripts/script.php?script_id=221
[2] http://wiki.alu.org:80/Vim_ECL
http://theclapp.org/lisp/ecl-repl.vim.latest
[3] http://www.lispniks.com/mailman/listinfo/slim-vim
[4] http://www.lisp-p.org/15-vim/
http://www.cliki.net/vim
http://vim.sourceforge.net/scripts/script.php?script_id=1230
and, of course, http://www.google.com/search?q=lisp+vim ;)
"Greg Buchholz" <················@yahoo.com> writes:
> Is there a tutorial out there which explains how to make the most
> of the REPL? My current usage is something like...
>
> * Open an editor in one window, and start a lisp image in another.
> * Type a definition or two and some tests into the editor, save, and
> then "load" into lisp.
> * Run some tests, rinse, repeat.
>
> ...Is there something more/better that I should be doing? How do I
> learn about the features like "*" being the previously evaluated value,
> etc. I'm currently using CMUCL, and one thing I've noticed is that I
> can't use the arrow keys for editing (like having the up-arrow retrieve
> the last expression entered, etc.). Do I need to compile in a version
> of Readline, or some such? Are the cursor navigation commands bound to
> other keys? Is this just a limitation of CMUCL, and I should try
> another Lisp variant? (I've browsed the CMUCL User's Manual, but
> haven't been able to find the section that talks about the REPL).
You could try GNU clisp, which is licensed appropriately so as to
allow readline to be compiled in. However, you would be better off
checking out SLIME, which plugs into Emacs to give you a REPL and
editor all in one place. You type Control-C Control-K (in Emacsese,
that's C-c C-k) to compile and load the file you're editing, and then
switch to the REPL to play with the results. Alt-P and Alt-N
(Emacsese: M-p and M-n) get you to the REPL history. Much other power
is at your hand, as well, such as Hyperspec lookups of the symbol the
cursor is on (C-c C-d h) and so forth.
http://common-lisp.net/project/slime/
You will, of course, also have to learn Emacs. But doing that will
only serve to make your Lisping more enjoyable, even if there is a bit
of a learning curve at first. It would be wise to go through the
Emacs tutorial (load up Emacs and, with default settings, you can load
the tutorial with C-h t). Google is also helpful in learning Emacs,
as is the comp.emacs group if you find a question that isn't quickly
answerable by way of Google.
Good luck!
I'm assuming you use emacs. For bringing up previous commands entered
into the repl buffer the default binding is M-p
I think you probably want to be studying up on emacs to learn all the
key bindings. It's really very convenient once you get used to the key
bindings. I personally find the forward/back word/s-exp functions very
useful when editing lisp code.
-Jeff
On 2006-05-04 12:33:30 -0400, "Greg Buchholz"
<················@yahoo.com> said:
> Is there a tutorial out there which explains how to make the most
> of the REPL? My current usage is something like...
>
> * Open an editor in one window, and start a lisp image in another.
> * Type a definition or two and some tests into the editor, save, and
> then "load" into lisp.
> * Run some tests, rinse, repeat.
>
> ...Is there something more/better that I should be doing? How do I
> learn about the features like "*" being the previously evaluated value,
> etc. I'm currently using CMUCL, and one thing I've noticed is that I
> can't use the arrow keys for editing (like having the up-arrow retrieve
> the last expression entered, etc.). Do I need to compile in a version
> of Readline, or some such? Are the cursor navigation commands bound to
> other keys? Is this just a limitation of CMUCL, and I should try
> another Lisp variant? (I've browsed the CMUCL User's Manual, but
> haven't been able to find the section that talks about the REPL).
>
> Thanks,
>
> Greg Buchholz
>>>>> "GB" == Greg Buchholz <················@yahoo.com> writes:
[...]
GB> ...Is there something more/better that I should be doing?
Yes. You can watch how many of us do it:
http://bc.tech.coop/blog/050728.html
(this should answer your other questions too)
GB> How
GB> do I learn about the features like "*" being the previously
GB> evaluated value, etc. [...]
I don't know how I know/learned, but the following link should help:
http://www.lispworks.com/documentation/HyperSpec/Body/25_aa.htm
cheers,
BM