tags:

views:

429

answers:

11

Clojure has introduced me to the concept of Lisp syntax, and I'm interested, but it's a pain to get the Clojure repl set up and use it on different machines. What other resources are there out there for actually on-the-fly testing and playing with Lisp syntax?

I'm imagining something like a website where you can input rudimentary code, or a browser add-on, or even just a standalone application that steps you through Lisp (something that runs on Linux/Ubuntu).

Haven't been able to find anything like that to start me off in a simple/accessible way.

+3  A: 

The SISC Online REPL is exactly what you need. It accepts Scheme syntax, which is a variant of Lisp.

For a standalone app I like PLT Scheme because it seems to work the same on every platform I've tried. I was previously using MIT Scheme on Ubuntu, but decided to switch when I bought a new machine with 64-bit Vista installed.

Bill the Lizard
Oh that so completely rocks! Awesome!
Benjamin Cox
Hmmm, the java applet that runs that just doesn't work for me. Looks like the kind of thing that I was looking for, but it doesn't actually work in FF or Chrome. Too bad, I'll have to look around to see if there's a workaround to get it working.
Tchalvak
@Tchalvak: Weird. It's working in FF on Vista for me right now.
Bill the Lizard
Sweet, that made me check again and it's working now. Pretty much exactly what I was looking for.
Tchalvak
+2  A: 

I've used LispBox in the past. Easy to set up and get going, but I have to admit that Emacs is second nature to me. If you're unfamiliar with that, you may can use another editor, but getting intimate with Emacs will help you live comfortably in Lispville.

Benjamin Cox
Yeah, Emacs is one of the stumbling blocks to the process. If I get into lisp, I will get into emacs, but I don't want to spend my time messing with emacs before dealing with lisp itself. I'll try it out, though.
Tchalvak
When I decided to learn Lisp a while ago, I realized I needed to know Emacs. I ended up learning Emacs, and after spending so much time on it, I never did find the time to learn Lisp...
Edan Maor
+1  A: 

I won't edit Lisp code without an editor that does what Emacs will do with the following configuration:

(define-key lisp-mode-shared-map "[" 'insert-parentheses)
(define-key lisp-mode-shared-map "]" 'move-past-close-and-reindent)

The former inserts balanced parentheses. If you give it a numeric prefix argument, it inserts that many nested pairs. By default, it inserts one. If you have a text region marked, it encloses that region in the innermost inserted pair. That means that you'll never open a parenthesis that's not closed.

The latter is harder to explain, as it's used less frequently. It's more of a navigation command than an insertion command. It confirms that you're done editing the current form and moves the cursor up, out, and past it, preparing for the next likely insertion.

With these keys bound, one no longer needs to use the Shift key to access the parentheses. Also, this leaves the parentheses keys bound as normal, for when sexp repair or a literal parenthesis character is required. I stole the bracket keys because they're used so infrequently in Emacs Lisp and Common Lisp. The bracket characters are still accessible with meta key bindings:

(defmacro make-key-inserter (def)
  "Substitute for `self-insert-command'."
  `(lambda (arg)
    (interactive "*P")
    (insert-char ,def (prefix-numeric-value arg))))

(define-key lisp-mode-shared-map "\M-[" (make-key-inserter ?\[))
(define-key lisp-mode-shared-map "\M-]" (make-key-inserter ?\]))

It's not essential to use Emacs, but don't settle for less with another editor that can't at least match this capability. There's also a whole family of commands for navigating and manipulating the sexp tree as a tree. Understanding why that's valuable will require you to fumble around for a while until you stop seeing syntax and start seeing the tree.

seh
Essentially my problem right now is that I need to get into the language/the syntax. I can see the benefits of getting involved with Emacs once I'm all hyped up about lisp in general, but having to learn/set up/have installed emacs is a lot of overhead along the way.
Tchalvak
There's no denying that setting up Emacs is a project. Really moving in is a whole lifestyle. However, be sure to understand that if you try Lisp with a very basic editor and decide you don't like it, it may well be because of the unhelpful editor with which you've saddled yourself. Don't give up that easily.This is the chicken-and-egg problem with easing into Lisp. When confronting Emacs, though, even if you decide you never want to touch Lisp again, you'll still have learned how to use a fantastic editor that will serve you well for most of your text-related needs.
seh
Right now, I effectively program in php with the advantage of only syntax highlighting. I don't expect to need much more (perhaps auto-indenting) out of a lisp editor. At least at first. Still, I'll keep this entry in mind for potential stuff after.
Tchalvak
+2  A: 

At the risk of losing all of my rep points, try newlisp.

Jeff Ober
+1  A: 

Since you're using Ubuntu, I'd just install some of the packages and give them a try.

Common Lisp: apt-get install clisp
Scheme: apt-get install drscheme

These aren't the only packaged implementations, but maybe the easier to get started with. You'll be able to play at a REPL and also run your own scripts through the interpreter.

MarcusBooster
+2  A: 

For learning Lisp the LispWorks personal edition is fine: LispWorks downloads. There are versions for Mac OS X, Windows, Linux and FreeBSD. All have the same user interface capabilities and this includes an editor and listener - plus lots of other tools. On Linux and FreeBSD in currently (LispWorks 5) uses X11/Motif for the GUI - this will change in a future version (LispWorks 6) to GTK. So to run it now under Linux, you need to have the Motif lib installed. Other than that using it is relatively painless. There are some restrictions to it (only 5 hours runtime, then you need to save and restart, ...) and the full version is commercial. But for learning some Lisp basics, it is quite good.

Rainer Joswig
+2  A: 

Franz has an online REPL for Allegro Common Lisp.

http://www.franz.com/products/allegrocl/prompt/

Brad Lucas
Prof Luke made me use this in school! Yea! AI class memories!
beggs
+1  A: 

BioBike provides a full Common Lisp evaluator through the web (with extras like a knowledge representation system, biocomputing, and an alternative visual langauge as well).

mtraven
+1  A: 

It's not hard to get to a Clojure REPL nowadays.

  1. Go to http://build.clojure.org/ and download clojure.jar.
  2. Install a JVM.
  3. java -jar clojure.jar

This should work on any machine that has a JVM installed.

For more fun, install rlwrap and use rlwrap java -jar clojure.

Brian Carper
Hah, fancy seeing you here. Your blog posts are part of what has made me thing about getting into clojure.
Tchalvak
*** think about the stuff involved with getting into clojure.
Tchalvak
Awesome! Hope you stick with it, Clojure is fun.
Brian Carper
+1  A: 

If you just want to play with LISP, interactively, quickly, GNU Emacs has a LISP interpreter built in, and listening in the *scratch* buffer. Type an S-expression, position immediately after it, and then hit Ctrl-J to evaluate it. Or <ESC>: will put an Eval: prompt in the minibuffer, accept an S-expression, and evaluate it.

You can define functions, using defun, and test things that way. You have access to ALL of the GNU Emacs built-in functions, and anything you have loaded. If you want to keep things around, you can put them in your .emacs file.

John R. Strohm
+1  A: 

codepad.org is a nice simple online way to enter and run code (in many different languages, including Scheme). I use it all the time for testing out snippets of code to use in SO answers.

Greg Hewgill
I like, great for lots of little language tests.
Tchalvak