Is Lisp the only language with REPL?

前端 未结 7 1883
失恋的感觉
失恋的感觉 2020-12-13 06:59

There are languages other than Lisp (ruby, scala) that say they use REPL (Read, Eval, Print, Loop), but it is unclear whether what is meant by REPL is the same as in Lisp. H

7条回答
  •  情深已故
    2020-12-13 07:33

    There's a nice project called multi-repl which exposes various REPLs via Node.JS:

    https://github.com/evilhackerdude/multi-repl

    If you look at the list of supported languages, it's quite clear that not only Lisp has the concept of a REPL.

    • clj (clojure)
    • ghci (ghc)
    • ipython
    • irb (ruby)
    • js (spidermonkey)
    • node
    • python
    • sbcl
    • v8

    In fact implementing a trivial one in Ruby is fairly easy:

    repl = -> prompt { print prompt; puts(" => %s" % eval(gets.chomp!)) }
    loop { repl[">> "] }
    

提交回复
热议问题