Skip to content

Comment on One Major Difference Between Clojure and Common Lispparent

Comments

I think the problem is that people seem to equate "Lisp" to "Common Lisp". Clojure is a Lisp, but Clojure is not Common Lisp.

LISP appeared in the late 50's/early 60's. Common Lisp only appeared in the early-to-mid 80's. There were many other lisps in between and many since. Common Lisp is only one of many dialects of Lisp. Clojure is another.

(Not saying that this is what lispm did in this case, (s)he seems to know a lot about lisp; rather this is a common confusion I've seen)

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.

Common Lisp, though, is the lineal descendant of the original LISP, so a case needs to be made for anything else like Scheme and Clojure that claim to be Lisps. I guess I'm saying it's a debatable point.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.