Live data from Hacker News

Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

hyperpolyglot.org

21–30 of 48 posts

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#21
post #13

Nice comparison. But makes me think we'd be better off if we all just focused on a single one, and grew it, made it better. Not having 4 versions of something almost identical. Fragmentation can hurt adoption.

That’s what Common Lisp is.

You got downvoted, but you're correct. Obligatory XKCD: https://xkcd.com/927/>

Personally I prefer lisp 1 languages, like scheme. Even there, though, there was a split over r6rs, so we got a bunch of mostly-like-r5rs schemes and racket.

Maybe the problem is that lisps are no longer popular enough to have a winning implementation! If there is one, though, then it's Common Lisp on SBCL.

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#22

Clojure 1.6, Emacs 24.5... These are pretty old versions, at least of those.

Emacs Lisp is a descendant of PDP-10 MAClisp, which makes it one of the oldest Lisp dialects still actively maintained. Whether it's version 24.5 or 30.2 doesn't make much of a difference semantically.

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#23
post #6

I know that the purpose of the page is to compare syntax of common lisp, racket, clojure, and emacs lisp. But some examples could be more idiomatic, for instance instead of (defun add (a &rest b) (if (null b) a (+ a (eval (cons '+ b))))) One should avoid eval and use endp instead of null: (defun add (a &rest b) (if (endp b) a (apply #'add (+ a (first b)) (rest b))))

Shouldn't it be (+ a (apply + b))

Almost. It should be (+ a (apply #'+ b)). Common Lisp is a Lisp-2, so a + in the argument position is assumed to be a variable named +, not the function named +, unless you specify otherwise.

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#26

Clojure 1.6, Emacs 24.5... These are pretty old versions, at least of those.

To be fair I think the only real differences since 1.6 you’d see are transducer versions of some of what’s in here for Clojure. The stuff expressed here is all very basic.

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#27
post #19
post #6

I know that the purpose of the page is to compare syntax of common lisp, racket, clojure, and emacs lisp. But some examples could be more idiomatic, for instance instead of (defun add (a &rest b) (if (null b) a (+ a (eval (cons '+ b))))) One should avoid eval and use endp instead of null: (defun add (a &rest b) (if (endp b) a (apply #'add (+ a (first b)) (rest b))))

Worse: Using recursion in Common Lisp isn't idiomatic, given that CL doesn't guarantee tail-call optimisation in the specification.

Sigh. This again.

All major Common Lisps support tail call optimization with proper declarations, with the exception of ABCL because it runs on the JVM.

And those declarations are all identical or almost identical, so it's easy to write an implementation-specific macro to guarantee TCO if you need to do so.

Some algorithms are easiest to express and read with looping constructs. For those algorithms, use looping constructs. Other algorithms are easiest to express and read with recursion. For those, use recursion. You shouldn't be afraid of recursion just because ANSI doesn't say TCO is guaranteed. You should be afraid of it if your code needs to run on ABCL, but otherwise, recur on.

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#28
post #19
post #6

I know that the purpose of the page is to compare syntax of common lisp, racket, clojure, and emacs lisp. But some examples could be more idiomatic, for instance instead of (defun add (a &rest b) (if (null b) a (+ a (eval (cons '+ b))))) One should avoid eval and use endp instead of null: (defun add (a &rest b) (if (endp b) a (apply #'add (+ a (first b)) (rest b))))

Worse: Using recursion in Common Lisp isn't idiomatic, given that CL doesn't guarantee tail-call optimisation in the specification.

[deleted]

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#29
post #8

The page indicates that there is not function for documentation in common lisp, but (documentation 'documentation 'function) "Return the documentation string of Doc-Type for X, or NIL if none exists. System doc-types are VARIABLE, FUNCTION, STRUCTURE, TYPE, SETF, and T. Also http://rosettacode.org for computer tasks implemented in many computer languages to allow you compare syntax and code.

Likewise apropos. It's an ANSI function.

Re: Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, Emacs Lisp

#30
post #25
post #3

Great chrestomathy! I opened a PR for my lisp, Loon: https://github.com/clarkgrubb/hyperpolyglot/pull/139

With all due respect, if this page adds a column for everyone's personal Lisp, it'll be as wide as the Pacific.

They say ethics and aesthetics are one!
Post reply on HN