3 ms·
Take a look at Smalltalk's environment and take a look a t Common Lisp's REPL. They have all the features that make for a good 'REPL'. (As noted before, REPL i
by flavio81 9y ago
Take a look at Smalltalk's environment and take a look a t Common Lisp's REPL. They have all the features that make for a good 'REPL'.
(As noted before, REPL is a Lisp term that stands for:
read - from keyboard input, parse the input string into the syntactic structure of the language
eval - eval the expression, this includes binding variables or defining new functions, also re-defining functions, even if such function is currently under execution on the running program.
print - print the result of the evaluation (in Lisp all expressions evaluate to something, even if this 'something' is NIL).
loop - go to 'read')
- junke 9y ago> in Lisp all expressions evaluate to something Minor nitpick, but note that if you define: (defun foo () (values)) Then (foo) does not return a value and accordingly, the REPL prints nothing. But in a context where you need a value, that value would be NIL: if A evaluates to 3, then after (setf a (foo)) it will evaluate to NIL.
- kazinator 9y agoAccording to a famous epigram by Alan Perlis, Lisp programmers know "the value of everything, but the cost of nothing". It reflects the expectation that a language which calls itself Lisp is expected to produce a value out of any expression which evaluates. Though Common Lisp adds the nuance of multiple values, the behavior you describe is how it conforms to this general expectation. Code written in an everything-really-has-one-value dialect of Lisp can be easily transported to Common Lisp (or at least transported without without difficulties specifically caused by this issue). Scheme, a Lisp-like language, allows some evaluable expressions to have an "undefined" or "unspecified" result value. Logic translated to Scheme from a Lisp dialect without attention to this issue can have a surprising or incorrect behavior. For instance, if the original code executes a do loop, with the expectation that it yields nil (or some similar false/empty value in the original dialect). In Scheme's do loop, if the result expression is present then it specifies the value; otherwise the value is not specified.
- flavio81 9y ago> Scheme, a Lisp-like language, allows some evaluable expressions to have an "undefined" or "unspecified" result value. That's why they are heretics !! (Just joking of course... Scheme is the other great Lisp dialect.)
- nerdponx 9y ago> Common Lisp's REPL The SBCL and CCL REPLs do not support readline-style editing. This actually makes them infuriating to use outside of Emacs or some other IDE-like environment. There is definitely a market for a high-quality, implementation-independent Lisp REPL.
- SomeHacker44 9y agorlwrap FTW
- nerdponx 9y agoAlso linedit. But using it still requires you to add it to your favorite implementation's init file. Would it be possible to write a "meta-REPL" using linedit? Then again, there already is a Jupyter kernel for CL, so maybe I should look into making that work for me.
- flavio81 9y ago> The SBCL and CCL REPLs do not support readline-style editing. This actually makes them infuriating to use outside of Emacs TL;DR: I fail to see how this can be a problem. Yes, but they do work fine inside Emacs (or perhaps inside other IDEs), and if i was using the SBCL command-line and needed readline-style-editing, then it was because I'm developing or debugging, so I'd be inside Emacs (or other IDE) in the first place...