2 ms·
If Clojure is Lisp, why doesn't it run any Lisp code? Take code from any Lisp book from the past 50 years and type it into Clojure. It won't work. Even really
by lispm 11y ago
If Clojure is Lisp, why doesn't it run any Lisp code?
Take code from any Lisp book from the past 50 years and type it into Clojure. It won't work. Even really basic Lisp code won't work.
> There were many other lisps in between and many since.
They all share a core language.
Simple REPL in Emacs Lisp:
ELISP> (defun read-eval-print-loop ()
(do* ((input (read) (read))
(value (eval input) (eval input)))
((equal input '(quote quit))
'done)
(print 'input>)
(princ input)
(print 'value>)
(princ input)
(print value)))
read-eval-print-loop
ELISP> (read-eval-print-loop)
input>
(mapcar (quote +) (quote (1 2 3)))
value>
(mapcar (quote +) (quote (1 2 3)))
(1 2 3)
done
Now OpenLisp, an implementation of ISLisp.
Code unchanged.
; OpenLisp v10.1.0 (Build: 5932) by C. Jullien [Aug 30 2014 - 07:38:27]
;; WARNING: \"startup.lsp\" file not loaded.
? (defun read-eval-print-loop ()
1> (do* ((input (read) (read))
3> (value (eval input) (eval input)))
2> ((equal input '(quote quit))
3> 'done)
2> (print 'input>)
2> (princ input)
2> (print 'value>)
2> (princ input)
2> (print value)))
;; elapsed time = 0.000s, (0 gc).
= read-eval-print-loop
? (read-eval-print-loop)
? (mapcar #'1+ '(1 2 3))
input>
(mapcar #'1+ '(1 2 3))value>
(mapcar #'1+ '(1 2 3))(2 3 4)
The output lacks correct formatting, but generally it works.
The same code unchanged in Common Lisp:
CL-USER> (defun read-eval-print-loop ()
(do* ((input (read) (read))
(value (eval input) (eval input)))
((equal input '(quote quit))
'done)
(print 'input>)
(princ input)
(print 'value>)
(princ input)
(print value)))
READ-EVAL-PRINT-LOOP
CL-USER> (read-eval-print-loop)
(mapcar '+ '(1 2 3))
INPUT> (MAPCAR (QUOTE +) (QUOTE (1 2 3)))
VALUE> (MAPCAR (QUOTE +) (QUOTE (1 2 3)))
(1 2 3)
'quit
DONE
Every language I would name Lisp runs this code mostly unchanged.
If it does not, it is not Lisp. Then it would be Scheme, Logo, Dylan, Clojure or some other language.