Recently I started learning Clojure and downloaded Clojure-Box for Windows which came with SLIME and have been fiddling around with Clojure using the REPL mode. Now, I have starting learning many languages that have REPL available (F#, Python, Haskell) but have never used it until I started with Clojure and I realized how much of a help it is.

I was wondering how many people use REPL for the languages that have them available. If you don't use them, what is your reasoning not to? If you do use them, do you use them for testing code or just for learning languages?

closed as primarily opinion-based by user40980, Dan Pichelman, gnat, BЈовић, user53019 Jul 30 '13 at 11:05

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.


I find the REPL very useful, especially when integrated with the text editor as in Clojure-Box or Lisp-Box. The big win is finding out right away if what you're trying to do will work properly. You can execute and test each function as you type it in instead of waiting for the entire application to compile.


Oh yes, I find them very useful. They're nice for testing out a few lines of code, to see if something really works the way you expect it to. Many languages with REPLs also make use of in-code documentation, so it can be really easy to look up an API for a class or module via the REPL.


Absolutely. I've been using GHCi (the Glasgow Haskell Compiler's REPL) quite often. Although I think the best way to learn how to design substantial programs is by typing them in a text editor (where you can write more than one line easily), a REPL provides some major advantages:

  • Makes testing one-liners easy, so you can learn language features quickly:

    > (\xs -> zip xs (tail xs)) [1..10]
    > (zip <*> tail) [1..10]
    > sortBy (\a b -> compare (length a) (length b)) ["ab", "abc", "a"]
    > sortBy (compare `on` length) ["ab", "abc", "a"]
  • Provides in-console documentation:

    > :i <*>
    class (Functor f) => Applicative f where
      (<*>) :: f (a -> b) -> f a -> f b
        -- Defined in Control.Applicative
    infixl 4 <*>
    > :i on
    on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
          -- Defined in Data.Function
    infixl 0 on
  • Great for doing simple (and even not-so-simple) tasks when you'd rather not write a whole program:

    > -- Find longest words that don't have repeated characters.
    > readFile "/home/joey/twl06" >>= mapM_ putStrLn . take 10 . reverse . sortBy (compare `on` length) . filter ((==) <*> nub) . lines

Once I discovered LINQPad, my IDE usage for scratch projects and learning went way down. Although not traditional REPL, it is a scratch-pad-type interface for .NET languages and is excellent for learning and testing. There are so many times that I just want to try something out quickly without the full-blown heavyweight development environment and REPL is perfect for that.


For Java with Hotspot-based virtual machines, you can update (with certain rules to obey) classes while running just by saving the revised source code in your IDE.

If your main loop invokes said classes repeatedly you effectively have a simple REPL which is very helpful.


I often do exploratory programming (for example to find out how to design an API). This often goes in one of two ways: either I actually use only REPL, or I use REPL to actually test manually whatever I wrote in an editor. In both cases REPL saves me huge amounts of time.

Also, REPL is the best for throw-away programming: when you have a task that you know you probably wont perform it again: f.e. for data mining (Sage+R and Python are brilliant for that) there are cases you might never have data in the same exact format, so you'd need to write routines to import specific files.

Not the answer you're looking for? Browse other questions tagged or ask your own question.