Skip to content
Swank server for the Racket programming language (formerly PLT Scheme)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests moved some code, added tests Apr 17, 2014
.gitignore readme Apr 10, 2014
LICENSE Initial commit Mar 7, 2014
README.md updated readme Apr 20, 2014
complete.rkt added macroexpand Apr 13, 2014
control.rkt fixed a problem Aug 19, 2014
describe.rkt fixed a problem Aug 19, 2014
eval.rkt fixed a problem Aug 19, 2014
getpid.rkt workaround for getpid; now works on windows Apr 2, 2014
modutil.rkt Revert "Revert "dump"" Aug 19, 2014
repl.rkt made * variables really work Apr 22, 2014
server.rkt split Apr 10, 2014
util.rkt added contracts Apr 21, 2014

README.md

swank-racket

This is a fork of the swank-racket project by dkvasnicka. It's a Swank server for the Racket programming language (formerly PLT Scheme).

Swank server is what gives you an interactive Lisp / Scheme environment when working with SLIME (Emacs) or SLIMV (Vim).

Status & limitations

Most of the basic stuff now works:

  • The REPL
  • basic completion
  • Compile & Load
  • Macroexpansion
  • Almost all of the Evaluation menu (defun, current-expression, region, buffer, interactive)

Missing

In a rough order of importance.

  • Documentation access
  • All the debugging stuff
  • Xref

Howto

Start the server

To start the server, just run racket server.rkt. The main program starts a server on 127.0.0.1:4005, and you can connect with it either with emacs (M-x slime-connect) or SLIMV (load a racket file and <leader>c). When the connection is successful, a REPL is started. Multiple clients are not supported.

The REPL

The REPL is a more or less like racket's built-in. You can type expressions, followed by enter. Racket will reply with the result of the evaluation. In the minibuffer you'll see information about the arities of the function you're about to call.

For example: if you write (car in the REPL, the minibuffer will show (car a). This happens also with user defined functions.

Restarts that aren't

Users of Common LIsp and SLIME are familiar with the concept of restarts. No such thing exists in racket (it can be implemented, though, call/cc and the like): in swank-racket we choose to simply abort. Maybe, in the future, Racket will provide something similar to conditions out of the box.

Special variables

Slime provides * ** *** / // /// + ++ +++ to get recent values. In Scheme, all these symbols are legal names (and may be "common" choices for some operator, e.g. ++ as an alias for append). In swank-racket, we use *1, *2, *3 *e. (these too are legal names, but less common; and they're used in swank-clojure too) In particular:

  • *1 gets the most recent result
  • *2 second most recent
  • *3 third most recent
  • *e last expression evaluated.

File loading

Compile and Load is the command you're looking for. The file is loaded and the current namespace is switched to the one in the current file. It's basically equivalent to racket's enter!. Any error is shown during the compilation process.

Vim & Emacs differences

Note that SLIMV's Compile-File (mapped to <leader>F) is functionally equivalent to Compile-Load-File (mapped to <leader>L), because it sends exactly the same command. With emacs, it works as expected: with Compile-file the file is compiled, but the functions are not available in the REPL. Compile-Load-File compiles and enters the module.

Developed using Racket 6.0 (and tested under 5.93, should work on every reasonably recent version).

Tested under Windows:

  • (g)Vim 7.4 + Python2.7 + SLIMV 0.9.12
  • emacs 24.2 + slime20130402

Differences with the original version by dkvasnicka

  • This version works on windows
  • Currently, it has more features
  • I don't use the sandbox to evaluate the code.

License

Eclipse Public License - v 1.0

You can’t perform that action at this time.