• Learning the REPL

    From Daniel Cerqueira@21:1/5 to All on Sat Feb 3 19:31:47 2024
    Hi.

    I am learning Common Lisp, and I use SBCL as my implementation.

    Are there any books about the REPL? SBCL's in my case.

    I can see that the REPL is a very powerful tool, but I don't know yet
    how to use it properly. I would feel more confident, if I knew how to
    recover from an error, and, specially, how to debug Common Lisp code.

    Is there any place on the Internet, or any book, that can teach me this?

    Thanks

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julieta Shem@21:1/5 to Daniel Cerqueira on Sun Feb 4 11:31:48 2024
    Daniel Cerqueira <dan.list@brilhante.top> writes:

    Hi.

    I am learning Common Lisp, and I use SBCL as my implementation.

    Are there any books about the REPL? SBCL's in my case.

    When you say SBCL's REPL, it seems you're using the REPL directly and
    not through another software such as the GNU EMACS, say. If you use the program rlwrap (readline-wrap), that's already an improvement to SBCL's
    REPL because you get GNU readline support.

    But you're using the GNU EMACS, so why not go with SLIME? It's, after
    all, the *superior* lisp interaction mode. Screenshot at

    https://slime.common-lisp.dev/

    I can see that the REPL is a very powerful tool, but I don't know yet
    how to use it properly. I would feel more confident, if I knew how to
    recover from an error, and, specially, how to debug Common Lisp code.

    My SBCL debugger tells me what to do.

    $ sbcl
    This is SBCL 2.3.7, an implementation of ANSI Common Lisp.
    More information about SBCL is available at <http://www.sbcl.org/>.

    SBCL is free software, provided as is, with absolutely no warranty.
    It is mostly in the public domain; some portions are provided under
    BSD-style licenses. See the CREDITS and COPYING files in the
    distribution for more information.
    * (error 'x "hello")

    debugger invoked on a SIMPLE-ERROR in thread
    #<THREAD tid=7816 "main thread" RUNNING {10013A8003}>:
    odd-length initializer list: ("hello").

    Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

    restarts (invokable by number or by possibly-abbreviated name):
    0: [ABORT] Exit debugger, returning to top level.

    (SB-KERNEL:ALLOCATE-CONDITION X "hello")
    0] 0
    * (format t "hello~%")
    hello
    NIL
    *

    Is there any place on the Internet, or any book, that can teach me this?

    Peter Seibel's ``Practical Common Lisp'' guides you with the GNU EMACS
    and SLIME. Chapter 2. I use the GNU EMACS and SLIME. It's wonderful.

    I saw a bundle of EMACS these days that I can't remember the name. It
    came with the GNU EMACS, SBCL and SLIME ready to be used for studying
    Common Lisp. Found it---it's called Portacle.

    https://portacle.github.io/

    You could use it right away while you learn how to set up SLIME on your
    own GNU EMACS and take it from there.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Daniel Cerqueira@21:1/5 to Julieta Shem on Sun Feb 4 15:21:41 2024
    Julieta Shem <jshem@yaxenu.org> writes:

    Daniel Cerqueira <dan.list@brilhante.top> writes:

    Hi.

    I am learning Common Lisp, and I use SBCL as my implementation.

    Are there any books about the REPL? SBCL's in my case.

    When you say SBCL's REPL, it seems you're using the REPL directly and
    not through another software such as the GNU EMACS, say. If you use the program rlwrap (readline-wrap), that's already an improvement to SBCL's
    REPL because you get GNU readline support.

    But you're using the GNU EMACS, so why not go with SLIME? It's, after
    all, the *superior* lisp interaction mode. Screenshot at

    https://slime.common-lisp.dev/

    I can see that the REPL is a very powerful tool, but I don't know yet
    how to use it properly. I would feel more confident, if I knew how to
    recover from an error, and, specially, how to debug Common Lisp code.

    My SBCL debugger tells me what to do.

    $ sbcl
    This is SBCL 2.3.7, an implementation of ANSI Common Lisp.
    More information about SBCL is available at <http://www.sbcl.org/>.

    SBCL is free software, provided as is, with absolutely no warranty.
    It is mostly in the public domain; some portions are provided under
    BSD-style licenses. See the CREDITS and COPYING files in the
    distribution for more information.
    * (error 'x "hello")

    debugger invoked on a SIMPLE-ERROR in thread
    #<THREAD tid=7816 "main thread" RUNNING {10013A8003}>:
    odd-length initializer list: ("hello").

    Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

    restarts (invokable by number or by possibly-abbreviated name):
    0: [ABORT] Exit debugger, returning to top level.

    (SB-KERNEL:ALLOCATE-CONDITION X "hello")
    0] 0
    * (format t "hello~%")
    hello
    NIL
    *

    Is there any place on the Internet, or any book, that can teach me this?

    Peter Seibel's ``Practical Common Lisp'' guides you with the GNU EMACS
    and SLIME. Chapter 2. I use the GNU EMACS and SLIME. It's wonderful.

    I saw a bundle of EMACS these days that I can't remember the name. It
    came with the GNU EMACS, SBCL and SLIME ready to be used for studying
    Common Lisp. Found it---it's called Portacle.

    https://portacle.github.io/

    You could use it right away while you learn how to set up SLIME on your
    own GNU EMACS and take it from there.

    Well, sorry for causing confusion. I use GNU Emacs, not SBCL on a
    command line. The difference is that, I use M-x run-lisp , instead of
    SLIME. SLIME does not let it's users create lisp images, and that put me
    off. Besides that important missing feature, if Emacs already has that
    feature, why install an extra package?

    What I specifically am looking for, is how to use the SBCL debugger. It
    has a lot of features, and I am looking for some hand-guiding on this
    (maybe a book? or an web page?).

    Also, it would be great if I just knew how to set up breakpoints on lisp
    code (using GNU Emacs), that would take me to the SBCL debugger, when
    reached.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julieta Shem@21:1/5 to Daniel Cerqueira on Sun Feb 4 14:03:28 2024
    Daniel Cerqueira <dan.list@brilhante.top> writes:

    Julieta Shem <jshem@yaxenu.org> writes:

    Daniel Cerqueira <dan.list@brilhante.top> writes:

    [...]

    Well, sorry for causing confusion. I use GNU Emacs, not SBCL on a
    command line. The difference is that, I use M-x run-lisp , instead of
    SLIME. SLIME does not let it's users create lisp images, and that put me
    off. Besides that important missing feature, if Emacs already has that feature, why install an extra package?

    Beginner here. I don't even know if SLIME can't create images. I think
    you want to create your own images of SBCL as changed by the REPL? The
    images I usually create here are just executable programs.

    $ cat build-exe.lisp
    (load "~/.sbclrc")
    (ql:quickload :package :silent t)
    (sb-ext:save-lisp-and-die #P"package.exe"
    :toplevel #'package:main
    :executable t)

    $ cat Makefile
    exe: package.lisp build-exe.lisp
    sbcl --script build-exe.lisp

    $ make exe
    sbcl --script build-exe.lisp

    $ file package.exe
    package.exe: PE32+ executable (console) x86-64, for MS Windows

    What I specifically am looking for, is how to use the SBCL debugger. It
    has a lot of features, and I am looking for some hand-guiding on this
    (maybe a book? or an web page?).

    Also, it would be great if I just knew how to set up breakpoints on lisp
    code (using GNU Emacs), that would take me to the SBCL debugger, when reached.

    I'll let the experts advise you on all of this.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Daniel Cerqueira on Sun Feb 4 22:32:20 2024
    On Sun, 04 Feb 2024 15:21:41 +0000, Daniel Cerqueira wrote:

    What I specifically am looking for, is how to use the SBCL debugger.

    <http://sbcl.org/manual/index.html#Debugger>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)