1

I'm brand-spanking new to LISP. I'm trying to get started with it, and I installed Steel Bank Common Lisp as well as SLIME so I can program in emacs. As far as I know, Slime simply provides an interactive mode, whereas editting .lisp and .el files is done in emacs lisp-mode. I'm trying to figure out how to use them in tandem.

I have a basic program where I defun a fibonacci number function, and I would like to simply hit M-x slime and test it out in slime. When I last tried, it said the function is undefined, leading me to believe that the slime buffer is not connected in any way to the .el file I opened slime from.

Error Message:

; SLIME 2.20
CL-USER> (fib 30)
; in: FIB 30
;     (FIB 30)
; 
; caught STYLE-WARNING:
;   undefined function: FIB
; 
; compilation unit finished
;   Undefined function:
;     FIB
;   caught 1 STYLE-WARNING condition

Is there an easy way to do what I'm trying to accomplish? I'm looking put myself into a position that promotes test driven development in a powerful language like Common Lisp.

If you have any help on this issue, or have any advice or resources for someone picking up Lisp, it would be greatly appreciated. Thanks!

middleman3
  • 11
  • 1
  • 2
  • 1
    I know less then zero about SLIME, but in Emacs when a function is undefined, it is usually because the library containing that function has not loaded. Usually loading the main library (e.g., `slime.el` or whatever it is that you downloaded and installed is sufficient. This is normally done by putting the library in the `load-path` and evaluating something like `M-x eval-expression RET (require 'slime) RET` or putting `(require 'slime)` in the `.emacs` file and restarting Emacs. Google for Emacs and load-path to start you on your journey regarding where to put your Elisp SLIME libraries. – lawlist Apr 26 '18 at 05:03

1 Answers1

7

It is simple as:

  1. Open emacs
  2. Open your lisp file with fibonachi function
  3. Issue M-x slime
  4. Place you cursor over fibonachi function and press C-c C-c to evaluate/compile it in Slime.
  5. switch to slime window and call (fibonachi 10)

Screenshot example with hello-world function: enter image description here

Maxim Kim
  • 1,516
  • 9
  • 17