3 ms·
The P stands for print. A REPL prints by definition.
by cup-of-tea 8y ago
The 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.