5 ms·
As someone who has learnt and loves Lisp it's really confusing to me that REPL has come to mean simply command interface. This is the REPL: (loop (print (e
by cup-of-tea 8y ago
As someone who has learnt and loves Lisp it's really confusing to me that REPL has come to mean simply command interface.
This is the REPL:
(loop (print (eval (read))))
- nixpulvis 8y agoThe key for me is that a REPL reads, then evaluates (generally involving printing), then starts over (looping). Bash for example fits this criteria. I'm as much of a fan of lisp as anyone, but it doesn't need to be literally printing the result of `eval` to be a REPL in my eyes.
- lispm 8y agobash doesn't print the result of an evaluation, the commands print if the want it's more a PEL: Parse Execute Loop
- earenndil 8y agoIn that case, most lisp 'repls' don't satisfy your definition either.
- lispm 8y agoMost Lisp REPLS print a result somewhere.
- cup-of-tea 8y agoThe P stands for print. A REPL prints by definition.
- earenndil 8y agoThen what is this? (defun add (a b) (+ a b))
- kbp 8y agoThat's some Lisp code; if you enter it at a REPL, it prints the result of evaluating it: CL-USER> (defun add (a b) (+ a b)) ADD
- lispm 8y agoThis is Lisp code defining a function ADD. If you enter it at a Lisp REPL, the REPL will read the expression, evaluate it and store it as a function. The result value is the name of the defined function. The REPL will then print the result, here the name of the function: ADD. CL-USER 13 > (defun add (a b) (+ a b)) ADD As you can see, the function does not print the Lisp symbol 'ADD', it's printed by the REPL. That's the P-component of R E P L, REPL. P stands for PRINT. This means that the REPL will always print a result - unless a Lisp function does not have a result - which is rare. If we execute the function, the REPL prints the result of the function: CL-USER 14 > (add 17 25) 42 Here the result is the number 42.
- kazinator 8y agoThat is an expression which evaluates to the symbol add. It also has an important side-effect of defining a function.
- hinkley 8y agoOr for those who read left to right: Read Eval Print Loop