Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Ask HN: Guide for Implementing Common Lisp. Parent comment
The compiler/interpreter gets as input Lisp data. Let's use READ, DESCRIBE and EVAL to see that working:
CL-USER 17 > (defun example (&aux input result) (terpri) ; newline (write-string "Input> ") (finish-output) (terpri) (setf input (read)) ; reading from input stream (terpri) (describe input) ; what did we read? (terpri) (write-string "Output>") (setf result (eval input)) ; evaluation (terpri) (write-string "Result>") (print result) ; printing the result (values)) ; return nothing EXAMPLE CL-USER 18 > (example) Input> (progn (print (+ 1 3)) (print 'done)) (PROGN (PRINT (+ 1 3)) (PRINT (QUOTE DONE))) is a LIST 0 PROGN 1 (PRINT (+ 1 3)) 2 (PRINT (QUOTE DONE)) Output> 4 DONE Result> DONE
EVAL is then taking code as a list and evaluates it to a value, as side effects there might be printed output of the program.
There are no comments on this comment yet.
The compiler/interpreter gets as input Lisp data. Let's use READ, DESCRIBE and EVAL to see that working:
As you can see READ in actual Lisp takes input from the keyboard and returns a list as data.EVAL is then taking code as a list and evaluates it to a value, as side effects there might be printed output of the program.